Browse Source

Replace u-hashrate with nonce-based hashrate adjusted for rejects/stales

Luke Dashjr 12 years ago
parent
commit
36aac1ccf1
2 changed files with 11 additions and 7 deletions
  1. 5 3
      README
  2. 6 4
      miner.c

+ 5 - 3
README

@@ -439,7 +439,8 @@ Each column is as follows:
   Hottest temperature reported by any processor
   5 second exponentially decaying average hash rate
   An all time average hash rate
-  An all time average hash rate based on actual accepted shares
+  An all time average hash rate based on actual nonces found, adjusted for pool
+      reject and stale rate
   The number of Accepted shares
   The number of Rejected shares and stale shares discarded (never submitted),
       and the percentage these are of total found.
@@ -497,8 +498,9 @@ that this data will be publicly seen if your miner finds a block using any
 GBT-enabled pool, even when not solo mining (such as failover). If your
 bitcoin node does not support longpolling (for example, bitcoind 0.8.x), you
 should consider setting up a failover pool to provide you with block
-notifications. Note that solo mining does not use shares, so BFGMiner's utility
-hashrate (third column) will swing widely and read zero until you find a block.
+notifications. Note that solo mining does not use shares, so BFGMiner's adjusted
+hashrate (third column) may suddenly drop to zero if a block you submit is
+rejected; this does not indicate that it has stopped mining.
 
 Example solo mining usage:
 

+ 6 - 4
miner.c

@@ -2779,7 +2779,6 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 	
 	double rolling = cgpu->rolling;
 	double mhashes = cgpu->total_mhashes;
-	double wutil = cgpu->utility_diff1;
 	int accepted = cgpu->accepted;
 	int rejected = cgpu->rejected;
 	int stale = cgpu->stale;
@@ -2797,7 +2796,6 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 			
 			rolling += slave->rolling;
 			mhashes += slave->total_mhashes;
-			wutil += slave->utility_diff1;
 			accepted += slave->accepted;
 			rejected += slave->rejected;
 			stale += slave->stale;
@@ -2808,6 +2806,8 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 			allnonces += slave->diff1;
 		}
 	
+	double wtotal = (waccepted + wnotaccepted);
+	
 	multi_format_unit_array2(
 		((char*[]){cHr, aHr, uHr}),
 		((size_t[]){h2bs_fmt_size[H2B_NOUNIT], h2bs_fmt_size[H2B_NOUNIT], h2bs_fmt_size[hashrate_style]}),
@@ -2815,7 +2815,7 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 		3,
 		1e6*rolling,
 		1e6*mhashes / dev_runtime,
-		utility_to_hashrate(wutil));
+		utility_to_hashrate(goodnonces * (wtotal ? (waccepted / wtotal) : 1) * 60 / dev_runtime));
 
 	// Processor representation
 #ifdef HAVE_CURSES
@@ -6875,6 +6875,8 @@ static void hashmeter(int thr_id, struct timeval *diff,
 	total_secs = (double)total_diff.tv_sec +
 		((double)total_diff.tv_usec / 1000000.0);
 
+	double wtotal = (total_diff_accepted + total_diff_rejected + total_diff_stale);
+	
 	multi_format_unit_array2(
 		((char*[]){cHr, aHr, uHr}),
 		((size_t[]){h2bs_fmt_size[H2B_NOUNIT], h2bs_fmt_size[H2B_NOUNIT], h2bs_fmt_size[H2B_SPACED]}),
@@ -6882,7 +6884,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
 		3,
 		1e6*rolling,
 		1e6*total_mhashes_done / total_secs,
-		utility_to_hashrate(total_diff_accepted / (total_secs ?: 1) * 60));
+		utility_to_hashrate(total_diff1 * (wtotal ? (total_diff_accepted / wtotal) : 1) * 60 / total_secs));
 
 #ifdef HAVE_CURSES
 	if (curses_active_locked()) {