Browse Source

Merge branch 'kanoi_english' into kanoi_0

Conflicts:
	driver-icarus.c
Luke Dashjr 13 years ago
parent
commit
87eeb495d4
1 changed files with 27 additions and 15 deletions
  1. 27 15
      driver-icarus.c

+ 27 - 15
driver-icarus.c

@@ -162,13 +162,18 @@ static int icarus_gets(unsigned char *buf, size_t bufLen, int fd, volatile unsig
 		}
 
 		rc++;
-		if (*wr)
+		if (*wr) {
+			rc *= ICARUS_READ_FAULT_DECISECONDS;
+			applog(LOG_DEBUG,
+			       "Icarus Read: Work restart at %d.%d seconds", rc / 10, rc % 10);
 			return 1;
+		}
 		if (rc >= read_count) {
 			if (epollfd != -1)
 				close(epollfd);
+			rc *= ICARUS_READ_FAULT_DECISECONDS;
 			applog(LOG_DEBUG,
-			       "Icarus Read: No data in %d seconds", rc * ICARUS_READ_FAULT_DECISECONDS / 10);
+			       "Icarus Read: No data in %d.%d seconds", rc / 10, rc % 10);
 			return 1;
 		}
 	}
@@ -346,25 +351,24 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 	gettimeofday(&tv_end, NULL);
 	timeval_subtract(&diff, &tv_end, &tv_start);
 
-	nonce_hex = bin2hex(nonce_bin, sizeof(nonce_bin));
-	if (nonce_hex) {
-		applog(LOG_DEBUG, "Icarus %d returned (in %d.%06d seconds): %s",
-		       icarus->device_id, diff.tv_sec, diff.tv_usec, nonce_hex);
-		free(nonce_hex);
-	}
-
 	memcpy((char *)&nonce, nonce_bin, sizeof(nonce_bin));
 
 	work->blk.nonce = 0xffffffff;
 	icarus_close(fd);
 
+	// aborted before becoming idle, get new work
 	if (nonce == 0 && ret) {
+		uint32_t ESTIMATE_HASHES;
 		if (unlikely(diff.tv_sec > 12 || (diff.tv_sec == 11 && diff.tv_usec > 300067)))
-			return 0xffffffff;
-		// Approximately how much of the nonce Icarus scans in 1 second...
-		// 0x16a7a561 would be if it was exactly 380 MH/s
-		// 0x168b7b4b was the average over a 201-sample period based on time to find actual shares
-		return (0x168b7b4b * diff.tv_sec) + (0x17a * diff.tv_usec);
+			ESTIMATE_HASHES = 0xffffffff;
+		else
+			// Approximately how much of the nonce Icarus scans in 1 second...
+			// 0x16a7a561 would be if it was exactly 380 MH/s
+			// 0x168b7b4b was the average over a 201-sample period based on time to find actual shares
+			ESTIMATE_HASHES = (0x168b7b4b * diff.tv_sec) + (0x17a * diff.tv_usec);
+		applog(LOG_DEBUG, "Icarus %d no nonce = 0x%08x hashes (%ld.%06lds)",
+			icarus->device_id, ESTIMATE_HASHES, diff.tv_sec, diff.tv_usec);
+		return ESTIMATE_HASHES;
 	}
 
 #ifndef __BIG_ENDIAN__
@@ -372,6 +376,13 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 #endif
 	submit_nonce(thr, work, nonce);
 
+	nonce_hex = bin2hex(nonce_bin, sizeof(nonce_bin));
+	if (nonce_hex) {
+		applog(LOG_DEBUG, "Icarus %d returned (elapsed %ld.%06ld seconds): %s",
+		       icarus->device_id, diff.tv_sec, diff.tv_usec, nonce_hex);
+		free(nonce_hex);
+	}
+
 	hash_count = (nonce & 0x7fffffff);
         if (hash_count == 0)
 		hash_count = 2;
@@ -382,7 +393,8 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
                         hash_count <<= 1;
         }
 
-	applog(LOG_DEBUG, "0x%x hashes in %d.%06d seconds", hash_count, diff.tv_sec, diff.tv_usec);
+	applog(LOG_DEBUG, "Icarus %d nonce = 0x%08x = 0x%08x hashes (%ld.%06lds)",
+			icarus->device_id, nonce, hash_count, diff.tv_sec, diff.tv_usec);
 
         return hash_count;
 }