Commit c08635d410898ef5848cfa4661a3264526d7635b

Kano 2014-01-19T23:10:06

bab record continuous (and max) bad nonces

diff --git a/driver-bab.c b/driver-bab.c
index 6b094f4..6ed6282 100644
--- a/driver-bab.c
+++ b/driver-bab.c
@@ -364,6 +364,9 @@ struct bab_info {
 	uint64_t chip_bad[BAB_MAXCHIPS];
 	uint64_t chip_ncore[BAB_MAXCHIPS][BAB_X_COORD][BAB_Y_COORD];
 
+	uint64_t chip_cont_bad[BAB_MAXCHIPS];
+	uint64_t chip_max_bad[BAB_MAXCHIPS];
+
 	uint64_t untested_nonces;
 	uint64_t tested_nonces;
 
@@ -1535,6 +1538,8 @@ static bool oknonce(struct thr_info *thr, struct cgpu_info *babcgpu, int chip, u
 							babinfo->max_proc_links = proc_links;
 						babinfo->total_work_links += work_links;
 
+						babinfo->chip_cont_bad[chip] = 0;
+
 #if UPDATE_HISTORY
 						process_history(babinfo, chip, when, true, &now);
 #endif
@@ -1562,6 +1567,10 @@ static bool oknonce(struct thr_info *thr, struct cgpu_info *babcgpu, int chip, u
 		babinfo->fail_total_links += links;
 		babinfo->fail_total_work_links += work_links;
 
+		babinfo->chip_cont_bad[chip]++;
+		if (babinfo->chip_max_bad[chip] < babinfo->chip_cont_bad[chip])
+			babinfo->chip_max_bad[chip] = babinfo->chip_cont_bad[chip];
+
 #if UPDATE_HISTORY
 		process_history(babinfo, chip, when, false, &now);
 #endif
@@ -2077,6 +2086,28 @@ static struct api_data *bab_api_stats(struct cgpu_info *babcgpu)
 			snprintf(buf, sizeof(buf),
 					"%s%"PRIu64,
 					j == i ? "" : " ",
+					babinfo->chip_cont_bad[j]);
+			strcat(data, buf);
+		}
+		snprintf(buf, sizeof(buf), "Cont-Bad %d - %d", i, to);
+		root = api_add_string(root, buf, data, true);
+
+		data[0] = '\0';
+		for (j = i; j <= to; j++) {
+			snprintf(buf, sizeof(buf),
+					"%s%"PRIu64,
+					j == i ? "" : " ",
+					babinfo->chip_max_bad[j]);
+			strcat(data, buf);
+		}
+		snprintf(buf, sizeof(buf), "Max-Bad %d - %d", i, to);
+		root = api_add_string(root, buf, data, true);
+
+		data[0] = '\0';
+		for (j = i; j <= to; j++) {
+			snprintf(buf, sizeof(buf),
+					"%s%"PRIu64,
+					j == i ? "" : " ",
 					history_good[j]);
 			strcat(data, buf);
 		}