Commit d9099794704cdad58171c34d4df7558a861baf20

Kano 2014-01-25T16:52:58

bab - also report dead chip count screen

diff --git a/driver-bab.c b/driver-bab.c
index bafa1cd..eaf7d42 100644
--- a/driver-bab.c
+++ b/driver-bab.c
@@ -2744,11 +2744,36 @@ static struct api_data *bab_api_stats(struct cgpu_info *babcgpu)
 static void bab_get_statline_before(char *buf, size_t bufsiz, struct cgpu_info *babcgpu)
 {
 	struct bab_info *babinfo = (struct bab_info *)(babcgpu->device_data);
+#if UPDATE_HISTORY
+	struct timeval now;
+	double elapsed;
+	int i, dead = 0;
 
+	cgtime(&now);
+	elapsed = tdiff(&now, &(babcgpu->dev_start_tv));
+
+	// At least get 15s of nonces before saying anything is dead
+	if (elapsed > 15.0) {
+		K_RLOCK(babinfo->nfree_list);
+		for (i = 0; i < babinfo->chips; i++) {
+			if (babinfo->good_nonces[i]->count == 0 &&
+			    babinfo->bad_nonces[i]->count > 1)
+				dead++;
+		}
+		K_RUNLOCK(babinfo->nfree_list);
+	}
+
+	tailsprintf(buf, bufsiz, "%d.%02d.%03d D:%03d | ",
+				 babinfo->banks,
+				 babinfo->boards,
+				 babinfo->chips,
+				 dead);
+#else
 	tailsprintf(buf, bufsiz, "B:%d B:%02d C:%03d | ",
 				 babinfo->banks,
 				 babinfo->boards,
 				 babinfo->chips);
+#endif
 }
 #endif