Add basic API stats for nfu drivers to see how many submits each chip returns
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
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 435753c..6951ccf 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -389,8 +389,7 @@ static void nfu_close(struct cgpu_info *bitfury)
static bool nfu_reinit(struct cgpu_info *bitfury, struct bitfury_info *info)
{
- bool ret;
-
+ bool ret = true;
int i;
for (i = 0; i < info->chips; i++) {
@@ -424,6 +423,7 @@ static void nfu_alloc_arrays(struct bitfury_info *info)
info->second_run = calloc(sizeof(bool), info->chips);
info->work = calloc(sizeof(struct work *), info->chips);
info->owork = calloc(sizeof(struct work *), info->chips);
+ info->submits = calloc(sizeof(int *), info->chips);
}
static bool nfu_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
@@ -1540,6 +1540,20 @@ static struct api_data *bxf_api_stats(struct cgpu_info *bitfury, struct bitfury_
return root;
}
+static struct api_data *nfu_api_stats(struct bitfury_info *info)
+{
+ struct api_data *root = NULL;
+ char buf[32];
+ int i;
+
+ root = api_add_int(root, "Chips", &info->chips, false);
+ for (i = 0; i < info->chips; i++) {
+ sprintf(buf, "Core%d submits", i);
+ root = api_add_int(root, buf, &info->submits[i], false);
+ }
+ return root;
+}
+
static struct api_data *bitfury_api_stats(struct cgpu_info *cgpu)
{
struct bitfury_info *info = cgpu->device_data;
@@ -1552,6 +1566,10 @@ static struct api_data *bitfury_api_stats(struct cgpu_info *cgpu)
case IDENT_OSM:
return bxf_api_stats(cgpu, info);
break;
+ case IDENT_NFU:
+ case IDENT_BXM:
+ return nfu_api_stats(info);
+ break;
default:
break;
}
diff --git a/libbitfury.c b/libbitfury.c
index 63da5b8..78f982c 100644
--- a/libbitfury.c
+++ b/libbitfury.c
@@ -370,8 +370,10 @@ bool libbitfury_sendHashData(struct thr_info *thr, struct cgpu_info *bitfury,
uint32_t nonce; //possible nonce
nonce = decnonce(newbuf[i]);
- if (bitfury_checkresults(thr, info->owork[chip_n], nonce))
+ if (bitfury_checkresults(thr, info->owork[chip_n], nonce)) {
+ info->submits[chip_n]++;
info->nonces++;
+ }
}
}
memcpy(oldbuf, newbuf, 17 * 4);