bab report bank/board/chip for dead and v.slow chips
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
diff --git a/driver-bab.c b/driver-bab.c
index feb2696..cb9a25a 100644
--- a/driver-bab.c
+++ b/driver-bab.c
@@ -1902,7 +1902,7 @@ static struct api_data *bab_api_stats(struct cgpu_info *babcgpu)
struct api_data *root = NULL;
char data[2048];
char buf[32];
- int spi_work, chip_work, i, to, j, sp;
+ int spi_work, chip_work, i, to, j, sp, bank, chip_off;
struct timeval now;
double elapsed, ghs;
float ghs_sum, ghs_tot;
@@ -2028,7 +2028,7 @@ static struct api_data *bab_api_stats(struct cgpu_info *babcgpu)
data[0] = '\0';
for (j = i; j <= to; j++) {
snprintf(buf, sizeof(buf),
- "%s0x%02x",
+ "%s%d",
j == i ? "" : " ",
(int)(babinfo->chip_fast[j]));
strcat(data, buf);
@@ -2177,7 +2177,7 @@ static struct api_data *bab_api_stats(struct cgpu_info *babcgpu)
ghs = chip_speed_ranges[sp];
else
ghs = chip_speed_ranges[BAB_CHIP_SPEEDS - 2];
-
+
snprintf(buf, sizeof(buf), "History Speed %s%.1f %s",
(sp < (BAB_CHIP_SPEEDS - 1)) ? "" : ">",
ghs, chip_speed_names[sp]);
@@ -2185,6 +2185,60 @@ static struct api_data *bab_api_stats(struct cgpu_info *babcgpu)
root = api_add_int(root, buf, &(speeds[sp]), true);
}
+ int len, str, siz = 1024;
+ char *tmp = malloc(siz);
+ if (!tmp)
+ quithere(1, "OOM tmp1");
+ for (sp = 0; sp < 2; sp++) {
+ tmp[0] = '\0';
+ len = 0;
+ for (i = 0; i < babinfo->chips; i++) {
+ if (history_elapsed[i] > 0) {
+ double num = history_good[i];
+ // exclude the first nonce?
+ if (elapsed_is_good[i])
+ num--;
+ ghs = num * 0xffffffffull /
+ history_elapsed[i] / 1000000000.0;
+ } else
+ ghs = 0;
+
+ if ((sp == 0 || ghs > chip_speed_ranges[sp-1]) &&
+ (ghs <= chip_speed_ranges[sp])) {
+ bank = babinfo->chip_bank[i];
+ chip_off = i;
+ for (j = 0; j < babinfo->chip_bank[i]; j++)
+ chip_off -= babinfo->chips_per_bank[j];
+ /*
+ * Bank/Board/Chip are all 1 based
+ * except V1 Bank = BAB_V1_BANK (0)
+ * If the bank has any missing chips then a "?"
+ * is placed after the board number
+ */
+ snprintf(buf, sizeof(buf), "%s%d/%d%s/%d",
+ len ? " " : "", bank,
+ (int)(chip_off / BAB_BOARDCHIPS)+1,
+ babinfo->missing_chips_per_bank[bank] ?
+ "?" : "",
+ (chip_off % BAB_BOARDCHIPS)+1);
+ str = strlen(buf);
+ while ((len + str + 1) > siz) {
+ siz += 1024;
+ tmp = realloc(tmp, siz);
+ if (!tmp)
+ quithere(1, "OOM tmp2");
+ }
+ strcpy(tmp + len, buf);
+ len += str;
+ }
+ }
+ snprintf(buf, sizeof(buf), "History %s", chip_speed_names[sp]);
+
+ root = api_add_string(root, buf, len ? tmp : "None", true);
+ }
+ free(tmp);
+ tmp = NULL;
+
for (i = 0; i < BAB_NONCE_OFFSETS; i++) {
snprintf(buf, sizeof(buf), "Nonce Offset 0x%08x", bab_nonce_offsets[i]);
root = api_add_uint64(root, buf, &(babinfo->nonce_offset_count[i]), true);