Browse Source

Rename *nonces variables to *_diff1 to reflect their nature better

Luke Dashjr 12 years ago
parent
commit
c2a17ee34c
3 changed files with 24 additions and 24 deletions
  1. 6 6
      api.c
  2. 16 16
      miner.c
  3. 2 2
      miner.h

+ 6 - 6
api.c

@@ -1513,7 +1513,7 @@ void devstatus_an(struct io_data *io_data, struct cgpu_info *cgpu, bool isjson,
 	enum alive status = cgpu->status;
 	float temp = -1;
 	int accepted = 0, rejected = 0, stale = 0, hw_errors = 0;
-	double diff1 = 0, bad_nonces = 0;
+	double diff1 = 0, bad_diff1 = 0;
 	double diff_accepted = 0, diff_rejected = 0, diff_stale = 0;
 	int last_share_pool = -1;
 	time_t last_share_pool_time = -1, last_device_valid_work = -1;
@@ -1535,7 +1535,7 @@ void devstatus_an(struct io_data *io_data, struct cgpu_info *cgpu, bool isjson,
 		diff_accepted += proc->diff_accepted;
 		diff_rejected += proc->diff_rejected;
 		diff_stale += proc->diff_stale;
-		bad_nonces += proc->bad_nonces;
+		bad_diff1 += proc->bad_diff1;
 		if (status != proc->status)
 			status = LIFE_MIXED;
 		if (proc->temp > temp)
@@ -1586,8 +1586,8 @@ void devstatus_an(struct io_data *io_data, struct cgpu_info *cgpu, bool isjson,
 		root = api_add_diff(root, "Last Share Difficulty", &last_share_diff, false);
 	if (last_device_valid_work != -1)
 		root = api_add_time(root, "Last Valid Work", &last_device_valid_work, false);
-	double hwp = (bad_nonces + diff1) ?
-			(double)(bad_nonces) / (double)(bad_nonces + diff1) : 0;
+	double hwp = (bad_diff1 + diff1) ?
+			(double)(bad_diff1) / (double)(bad_diff1 + diff1) : 0;
 	root = api_add_percent(root, "Device Hardware%", &hwp, false);
 	double rejp = diff1 ?
 			(double)(diff_rejected) / (double)(diff1) : 0;
@@ -2094,8 +2094,8 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
 	root = api_add_diff(root, "Difficulty Rejected", &(total_diff_rejected), true);
 	root = api_add_diff(root, "Difficulty Stale", &(total_diff_stale), true);
 	root = api_add_uint64(root, "Best Share", &(best_diff), true);
-	double hwp = (total_bad_nonces + total_diff1) ?
-			(double)(total_bad_nonces) / (double)(total_bad_nonces + total_diff1) : 0;
+	double hwp = (total_bad_diff1 + total_diff1) ?
+			(double)(total_bad_diff1) / (double)(total_bad_diff1 + total_diff1) : 0;
 	root = api_add_percent(root, "Device Hardware%", &hwp, false);
 	double rejp = total_diff1 ?
 			(double)(total_diff_rejected) / (double)(total_diff1) : 0;

+ 16 - 16
miner.c

@@ -280,7 +280,7 @@ int hw_errors;
 int total_accepted, total_rejected;
 int total_getworks, total_stale, total_discarded;
 uint64_t total_bytes_rcvd, total_bytes_sent;
-double total_diff1, total_bad_nonces;
+double total_diff1, total_bad_diff1;
 double total_diff_accepted, total_diff_rejected, total_diff_stale;
 static int staged_rollable;
 unsigned int new_blocks;
@@ -3273,7 +3273,7 @@ static void adj_width(int var, int *length);
 static int awidth = 1, rwidth = 1, swidth = 1, hwwidth = 1;
 
 static
-void format_statline(char *buf, size_t bufsz, const char *cHr, const char *aHr, const char *uHr, int accepted, int rejected, int stale, int wnotaccepted, int waccepted, int hwerrs, int badnonces, int allnonces)
+void format_statline(char *buf, size_t bufsz, const char *cHr, const char *aHr, const char *uHr, int accepted, int rejected, int stale, int wnotaccepted, int waccepted, int hwerrs, int bad_diff1, int allnonces)
 {
 	char rejpcbuf[6];
 	char bnbuf[6];
@@ -3283,7 +3283,7 @@ void format_statline(char *buf, size_t bufsz, const char *cHr, const char *aHr,
 	adj_width(stale, &swidth);
 	adj_width(hwerrs, &hwwidth);
 	percentf4(rejpcbuf, sizeof(rejpcbuf), wnotaccepted, waccepted);
-	percentf3(bnbuf, sizeof(bnbuf), badnonces, allnonces);
+	percentf3(bnbuf, sizeof(bnbuf), bad_diff1, allnonces);
 	
 	tailsprintf(buf, bufsz, "%s/%s/%s | A:%*d R:%*d+%*d(%s) HW:%*d/%s",
 	            cHr, aHr, uHr,
@@ -3339,10 +3339,10 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 	double waccepted;
 	double wnotaccepted;
 	int hwerrs;
-	double badnonces, goodnonces;
+	double bad_diff1, good_diff1;
 	
 	rolling = mhashes = waccepted = wnotaccepted = 0;
-	accepted = rejected = stale = hwerrs = badnonces = goodnonces = 0;
+	accepted = rejected = stale = hwerrs = bad_diff1 = good_diff1 = 0;
 	
 	{
 		struct cgpu_info *slave = cgpu;
@@ -3368,8 +3368,8 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 			waccepted += slave->diff_accepted;
 			wnotaccepted += slave->diff_rejected + slave->diff_stale;
 			hwerrs += slave->hw_errors;
-			badnonces += slave->bad_nonces;
-			goodnonces += slave->diff1;
+			bad_diff1 += slave->bad_diff1;
+			good_diff1 += slave->diff1;
 			
 			if (opt_show_procs)
 				break;
@@ -3385,7 +3385,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(goodnonces * (wtotal ? (waccepted / wtotal) : 1) * 60 / dev_runtime));
+		utility_to_hashrate(good_diff1 * (wtotal ? (waccepted / wtotal) : 1) * 60 / dev_runtime));
 
 	// Processor representation
 #ifdef HAVE_CURSES
@@ -3483,13 +3483,13 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 		                accepted, rejected, stale,
 		                wnotaccepted, waccepted,
 		                hwerrs,
-		                badnonces, badnonces + goodnonces);
+		                bad_diff1, bad_diff1 + good_diff1);
 	}
 	else
 #endif
 	{
 		percentf4(rejpcbuf, sizeof(rejpcbuf), wnotaccepted, waccepted);
-		percentf4(bnbuf, sizeof(bnbuf), badnonces, goodnonces);
+		percentf4(bnbuf, sizeof(bnbuf), bad_diff1, good_diff1);
 		tailsprintf(buf, bufsz, "%ds:%s avg:%s u:%s | A:%d R:%d+%d(%s) HW:%d/%s",
 			opt_log_interval,
 			cHr, aHr, uHr,
@@ -6700,7 +6700,7 @@ void zero_stats(void)
 	total_ro = 0;
 	total_secs = 1.0;
 	total_diff1 = 0;
-	total_bad_nonces = 0;
+	total_bad_diff1 = 0;
 	found_blocks = 0;
 	total_diff_accepted = 0;
 	total_diff_rejected = 0;
@@ -6763,7 +6763,7 @@ void zero_stats(void)
 		cgpu->utility = 0.0;
 		cgpu->utility_diff1 = 0;
 		cgpu->last_share_pool_time = 0;
-		cgpu->bad_nonces = 0;
+		cgpu->bad_diff1 = 0;
 		cgpu->diff1 = 0;
 		cgpu->diff_accepted = 0;
 		cgpu->diff_rejected = 0;
@@ -7787,7 +7787,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
 		                ui_stale,
 		                total_diff_rejected + total_diff_stale, total_diff_accepted,
 		                hw_errors,
-		                total_bad_nonces, total_bad_nonces + total_diff1);
+		                total_bad_diff1, total_bad_diff1 + total_diff1);
 		unlock_curses();
 	}
 #endif
@@ -7797,7 +7797,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
 	uHr[5] = ' ';
 	
 	percentf4(rejpcbuf, sizeof(rejpcbuf), total_diff_rejected + total_diff_stale, total_diff_accepted);
-	percentf4(bnbuf, sizeof(bnbuf), total_bad_nonces, total_diff1);
+	percentf4(bnbuf, sizeof(bnbuf), total_bad_diff1, total_diff1);
 	
 	snprintf(logstatusline, sizeof(logstatusline),
 	         "%s%ds:%s avg:%s u:%s | A:%d R:%d+%d(%s) HW:%d/%s",
@@ -8945,8 +8945,8 @@ void inc_hw_errors2(struct thr_info *thr, const struct work *work, const uint32_
 	++cgpu->hw_errors;
 	if (bad_nonce_p)
 	{
-		total_bad_nonces += work->work_difficulty;
-		cgpu->bad_nonces += work->work_difficulty;
+		total_bad_diff1 += work->work_difficulty;
+		cgpu->bad_diff1 += work->work_difficulty;
 	}
 	mutex_unlock(&stats_lock);
 

+ 2 - 2
miner.h

@@ -499,7 +499,7 @@ struct cgpu_info {
 	int accepted;
 	int rejected;
 	int stale;
-	double bad_nonces;
+	double bad_diff1;
 	int hw_errors;
 	double rolling;
 	double total_mhashes;
@@ -1125,7 +1125,7 @@ extern int total_accepted, total_rejected;
 extern int total_getworks, total_stale, total_discarded;
 extern uint64_t total_bytes_rcvd, total_bytes_sent;
 #define total_bytes_xfer (total_bytes_rcvd + total_bytes_sent)
-extern double total_diff1, total_bad_nonces;
+extern double total_diff1, total_bad_diff1;
 extern double total_diff_accepted, total_diff_rejected, total_diff_stale;
 extern unsigned int local_work;
 extern unsigned int total_go, total_ro;