Browse Source

Replace work-based efficiency with new bandwidth-based efficiency

2 KB replaces the "work unit" based on approximate bandwidth usage of a single getwork request + submit
Luke Dashjr 13 years ago
parent
commit
b5f322af4e
4 changed files with 23 additions and 14 deletions
  1. 7 6
      README
  2. 11 8
      miner.c
  3. 1 0
      miner.h
  4. 4 0
      util.c

+ 7 - 6
README

@@ -416,7 +416,8 @@ A:   The number of Accepted shares
 R:   The number of Rejected shares
 R:   The number of Rejected shares
 S:   Stale shares discarded (not submitted so don't count as rejects)
 S:   Stale shares discarded (not submitted so don't count as rejects)
 HW:  The number of HardWare errors
 HW:  The number of HardWare errors
-E:   The Efficiency defined as number of shares returned / work item
+E:   The Efficiency defined as number of shares accepted (multiplied by their
+         difficulty) per 2 KB of bandwidth
 U:   The Utility defined as the number of shares / minute
 U:   The Utility defined as the number of shares / minute
 
 
  GPU 1: 73.5C 2551RPM | 427.3/443.0/442.1Mh/s | A:8 R:0 HW:0 U:4.39/m
  GPU 1: 73.5C 2551RPM | 427.3/443.0/442.1Mh/s | A:8 R:0 HW:0 U:4.39/m
@@ -868,11 +869,11 @@ A: The defaults are sane and safe. I'm not interested in changing them
 further. The starting fan speed is set to 50% in auto-fan mode as a safety
 further. The starting fan speed is set to 50% in auto-fan mode as a safety
 precaution.
 precaution.
 
 
-Q: Why is my efficiency above/below 100%?
-A: Efficiency simply means how many shares you return for the amount of work
-you request. It does not correlate with efficient use of your hardware, and is
-a measure of a combination of hardware speed, block luck, pool design and other
-factors
+Q: Why is my efficiency above/below 1.00?
+A: Efficiency simply means how many shares you return for the amount of
+bandwidth used. It does not correlate with efficient use of your hardware, and
+is a measure of a combination of hardware speed, block luck, pool design and
+other factors.
 
 
 Q: What are the best parameters to pass for X pool/hardware/device.
 Q: What are the best parameters to pass for X pool/hardware/device.
 A: Virtually always, the DEFAULT parameters give the best results. Most user
 A: Virtually always, the DEFAULT parameters give the best results. Most user

+ 11 - 8
miner.c

@@ -231,6 +231,7 @@ int submit_waiting_notifier[2];
 int hw_errors;
 int hw_errors;
 int total_accepted, total_rejected, total_diff1;
 int total_accepted, total_rejected, total_diff1;
 int total_getworks, total_stale, total_discarded;
 int total_getworks, total_stale, total_discarded;
+uint64_t total_bytes_xfer;
 double total_diff_accepted, total_diff_rejected, total_diff_stale;
 double total_diff_accepted, total_diff_rejected, total_diff_stale;
 static int staged_rollable;
 static int staged_rollable;
 unsigned int new_blocks;
 unsigned int new_blocks;
@@ -4439,8 +4440,9 @@ static void display_pool_summary(struct pool *pool)
 		wlog(" Rejected difficulty shares: %1.f\n", pool->diff_rejected);
 		wlog(" Rejected difficulty shares: %1.f\n", pool->diff_rejected);
 		if (pool->accepted || pool->rejected)
 		if (pool->accepted || pool->rejected)
 			wlog(" Reject ratio: %.1f%%\n", (double)(pool->rejected * 100) / (double)(pool->accepted + pool->rejected));
 			wlog(" Reject ratio: %.1f%%\n", (double)(pool->rejected * 100) / (double)(pool->accepted + pool->rejected));
-		efficiency = pool->getwork_requested ? pool->accepted * 100.0 / pool->getwork_requested : 0.0;
-		wlog(" Efficiency (accepted / queued): %.0f%%\n", efficiency);
+		uint64_t pool_bytes_xfer = pool->cgminer_pool_stats.bytes_received + pool->cgminer_pool_stats.bytes_sent;
+		efficiency = pool_bytes_xfer ? pool->diff_accepted * 2048. / pool_bytes_xfer : 0.0;
+		wlog(" Efficiency (accepted * difficulty / 2 KB): %.2f\n", efficiency);
 
 
 		wlog(" Discarded work due to new blocks: %d\n", pool->discarded_work);
 		wlog(" Discarded work due to new blocks: %d\n", pool->discarded_work);
 		wlog(" Stale submissions discarded due to new blocks: %d\n", pool->stale_shares);
 		wlog(" Stale submissions discarded due to new blocks: %d\n", pool->stale_shares);
@@ -5277,7 +5279,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
 		((double)total_diff.tv_usec / 1000000.0);
 		((double)total_diff.tv_usec / 1000000.0);
 
 
 	utility = total_accepted / total_secs * 60;
 	utility = total_accepted / total_secs * 60;
-	efficiency = total_getworks ? total_accepted * 100.0 / total_getworks : 0.0;
+	efficiency = total_bytes_xfer ? total_diff_accepted * 2048. / total_bytes_xfer : 0.0;
 
 
 	ti_hashrate_bufstr(
 	ti_hashrate_bufstr(
 		(char*[]){cHr, aHr, uHr},
 		(char*[]){cHr, aHr, uHr},
@@ -5286,7 +5288,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
 		utility_to_hashrate(total_diff_accepted / (total_secs ?: 1) * 60),
 		utility_to_hashrate(total_diff_accepted / (total_secs ?: 1) * 60),
 		H2B_SPACED);
 		H2B_SPACED);
 
 
-	sprintf(statusline, "%s%ds:%s avg:%s u:%s | A:%d R:%d S:%d HW:%d E:%.0f%% U:%.1f/m",
+	sprintf(statusline, "%s%ds:%s avg:%s u:%s | A:%d R:%d S:%d HW:%d E:%.2f U:%.1f/m",
 		want_per_device_stats ? "ALL " : "",
 		want_per_device_stats ? "ALL " : "",
 		opt_log_interval,
 		opt_log_interval,
 		cHr, aHr,
 		cHr, aHr,
@@ -6999,7 +7001,7 @@ static void print_summary(void)
 	secs = diff.tv_sec % 60;
 	secs = diff.tv_sec % 60;
 
 
 	utility = total_accepted / total_secs * 60;
 	utility = total_accepted / total_secs * 60;
-	efficiency = total_getworks ? total_accepted * 100.0 / total_getworks : 0.0;
+	efficiency = total_bytes_xfer ? total_diff_accepted * 2048. / total_bytes_xfer : 0.0;
 	work_util = total_diff1 / total_secs * 60;
 	work_util = total_diff1 / total_secs * 60;
 
 
 	applog(LOG_WARNING, "\nSummary of runtime statistics:\n");
 	applog(LOG_WARNING, "\nSummary of runtime statistics:\n");
@@ -7023,7 +7025,7 @@ static void print_summary(void)
 	if (total_accepted || total_rejected)
 	if (total_accepted || total_rejected)
 		applog(LOG_WARNING, "Reject ratio: %.1f%%", (double)(total_rejected * 100) / (double)(total_accepted + total_rejected));
 		applog(LOG_WARNING, "Reject ratio: %.1f%%", (double)(total_rejected * 100) / (double)(total_accepted + total_rejected));
 	applog(LOG_WARNING, "Hardware errors: %d", hw_errors);
 	applog(LOG_WARNING, "Hardware errors: %d", hw_errors);
-	applog(LOG_WARNING, "Efficiency (accepted / queued): %.0f%%", efficiency);
+	applog(LOG_WARNING, "Efficiency (accepted shares * difficulty / 2 KB): %.2f", efficiency);
 	applog(LOG_WARNING, "Utility (accepted shares / min): %.2f/min\n", utility);
 	applog(LOG_WARNING, "Utility (accepted shares / min): %.2f/min\n", utility);
 
 
 	applog(LOG_WARNING, "Discarded work due to new blocks: %d", total_discarded);
 	applog(LOG_WARNING, "Discarded work due to new blocks: %d", total_discarded);
@@ -7048,8 +7050,9 @@ static void print_summary(void)
 			applog(LOG_WARNING, " Rejected difficulty shares: %1.f", pool->diff_rejected);
 			applog(LOG_WARNING, " Rejected difficulty shares: %1.f", pool->diff_rejected);
 			if (pool->accepted || pool->rejected)
 			if (pool->accepted || pool->rejected)
 				applog(LOG_WARNING, " Reject ratio: %.1f%%", (double)(pool->rejected * 100) / (double)(pool->accepted + pool->rejected));
 				applog(LOG_WARNING, " Reject ratio: %.1f%%", (double)(pool->rejected * 100) / (double)(pool->accepted + pool->rejected));
-			efficiency = pool->getwork_requested ? pool->accepted * 100.0 / pool->getwork_requested : 0.0;
-			applog(LOG_WARNING, " Efficiency (accepted / queued): %.0f%%", efficiency);
+			uint64_t pool_bytes_xfer = pool->cgminer_pool_stats.bytes_received + pool->cgminer_pool_stats.bytes_sent;
+			efficiency = pool_bytes_xfer ? pool->diff_accepted * 2048. / pool_bytes_xfer : 0.0;
+			applog(LOG_WARNING, " Efficiency (accepted * difficulty / 2 KB): %.2f", efficiency);
 
 
 			applog(LOG_WARNING, " Discarded work due to new blocks: %d", pool->discarded_work);
 			applog(LOG_WARNING, " Discarded work due to new blocks: %d", pool->discarded_work);
 			applog(LOG_WARNING, " Stale submissions discarded due to new blocks: %d", pool->stale_shares);
 			applog(LOG_WARNING, " Stale submissions discarded due to new blocks: %d", pool->stale_shares);

+ 1 - 0
miner.h

@@ -825,6 +825,7 @@ extern unsigned int new_blocks;
 extern unsigned int found_blocks;
 extern unsigned int found_blocks;
 extern int total_accepted, total_rejected, total_diff1;;
 extern int total_accepted, total_rejected, total_diff1;;
 extern int total_getworks, total_stale, total_discarded;
 extern int total_getworks, total_stale, total_discarded;
+extern uint64_t total_bytes_xfer;
 extern double total_diff_accepted, total_diff_rejected, total_diff_stale;
 extern double total_diff_accepted, total_diff_rejected, total_diff_stale;
 extern unsigned int local_work;
 extern unsigned int local_work;
 extern unsigned int total_go, total_ro;
 extern unsigned int total_go, total_ro;

+ 4 - 0
util.c

@@ -314,10 +314,12 @@ static int my_curl_debug(__maybe_unused CURL *curl, curl_infotype infotype, char
 		case CURLINFO_HEADER_IN:
 		case CURLINFO_HEADER_IN:
 		case CURLINFO_DATA_IN:
 		case CURLINFO_DATA_IN:
 			pool->cgminer_pool_stats.bytes_received += datasz;
 			pool->cgminer_pool_stats.bytes_received += datasz;
+			total_bytes_xfer += datasz;
 			break;
 			break;
 		case CURLINFO_HEADER_OUT:
 		case CURLINFO_HEADER_OUT:
 		case CURLINFO_DATA_OUT:
 		case CURLINFO_DATA_OUT:
 			pool->cgminer_pool_stats.bytes_sent += datasz;
 			pool->cgminer_pool_stats.bytes_sent += datasz;
+			total_bytes_xfer += datasz;
 			break;
 			break;
 		default:
 		default:
 			break;
 			break;
@@ -990,6 +992,7 @@ static bool __stratum_send(struct pool *pool, char *s, ssize_t len)
 
 
 	pool->cgminer_pool_stats.times_sent++;
 	pool->cgminer_pool_stats.times_sent++;
 	pool->cgminer_pool_stats.bytes_sent += ssent;
 	pool->cgminer_pool_stats.bytes_sent += ssent;
+	total_bytes_xfer += ssent;
 	return true;
 	return true;
 }
 }
 
 
@@ -1086,6 +1089,7 @@ char *recv_line(struct pool *pool)
 
 
 	pool->cgminer_pool_stats.times_received++;
 	pool->cgminer_pool_stats.times_received++;
 	pool->cgminer_pool_stats.bytes_received += len;
 	pool->cgminer_pool_stats.bytes_received += len;
+	total_bytes_xfer += len;
 
 
 out:
 out:
 	if (!sret)
 	if (!sret)