Browse Source

Bugfix: modminer & x6500: Increment *->diff1 for all bad nonces, and do stats changes within stats_lock

Luke Dashjr 12 years ago
parent
commit
5d3d5a6a51
2 changed files with 14 additions and 0 deletions
  1. 7 0
      driver-modminer.c
  2. 7 0
      driver-x6500.c

+ 7 - 0
driver-modminer.c

@@ -22,6 +22,8 @@
 #include "fpgautils.h"
 #include "util.h"
 
+extern pthread_mutex_t stats_lock;
+
 #define BITSTREAM_FILENAME "fpgaminer_x6500-overclocker-0402.bit"
 #define BISTREAM_USER_ID "\2\4$B"
 
@@ -712,8 +714,13 @@ modminer_process_results(struct thr_info*thr)
 				applog(LOG_DEBUG, "%s: Nonce with H not zero  : %02x%02x%02x%02x",
 				       modminer->proc_repr,
 				       NONCE_CHARS(nonce));
+				mutex_lock(&stats_lock);
+				++total_diff1;
+				++modminer->diff1;
+				++work->pool->diff1;
 				++hw_errors;
 				++modminer->hw_errors;
+				mutex_unlock(&stats_lock);
 				++state->bad_share_counter;
 				++immediate_bad_nonces;
 			}

+ 7 - 0
driver-x6500.c

@@ -27,6 +27,8 @@
 #include "fpgautils.h"
 #include "ft232r.h"
 
+extern pthread_mutex_t stats_lock;
+
 #define X6500_USB_PRODUCT "X6500 FPGA Miner"
 #define X6500_BITSTREAM_FILENAME "fpgaminer_x6500-overclocker-0402.bit"
 // NOTE: X6500_BITSTREAM_USERID is bitflipped
@@ -748,8 +750,13 @@ int64_t x6500_process_results(struct thr_info *thr, struct work *work)
 				applog(LOG_DEBUG, "%"PRIprepr": Nonce with H not zero  : %08lx",
 				       x6500->proc_repr,
 				       (unsigned long)nonce);
+				mutex_lock(&stats_lock);
+				++total_diff1;
+				++x6500->diff1;
+				++work->pool->diff1;
 				++hw_errors;
 				++x6500->hw_errors;
+				mutex_unlock(&stats_lock);
 
 				dclk_gotNonces(&fpga->dclk);
 				dclk_errorCount(&fpga->dclk, 1.);