bflsc28 stats
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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
diff --git a/driver-bflsc.c b/driver-bflsc.c
index 1ff92bb..a84adbd 100644
--- a/driver-bflsc.c
+++ b/driver-bflsc.c
@@ -866,7 +866,8 @@ reinit:
}
}
- if (usb_ident(bflsc) == IDENT_BMA) {
+ sc_info->ident = usb_ident(bflsc);
+ if (sc_info->ident == IDENT_BMA) {
bflsc->drv->queue_full = &bflsc28_queue_full;
sc_info->scan_sleep_time = BMA_SCAN_TIME;
sc_info->default_ms_work = BMA_WORK_TIME;
@@ -1249,8 +1250,13 @@ static bool bflsc_get_temp(struct cgpu_info *bflsc, int dev)
static void inc_core_errors(struct bflsc_info *info, int8_t core)
{
- if (core >= 0 && core < 16)
- info->core_hw[core]++;
+ if (info->ident == IDENT_BMA) {
+ if (core >= 0)
+ info->cortex_hw[core]++;
+ } else {
+ if (core >= 0 && core < 16)
+ info->core_hw[core]++;
+ }
}
static void inc_bflsc_errors(struct thr_info *thr, struct bflsc_info *info, int8_t core)
@@ -1261,8 +1267,13 @@ static void inc_bflsc_errors(struct thr_info *thr, struct bflsc_info *info, int8
static void inc_bflsc_nonces(struct bflsc_info *info, int8_t core)
{
- if (core >= 0 && core < 16)
- info->core_nonces[core]++;
+ if (info->ident == IDENT_BMA) {
+ if (core >= 0)
+ info->cortex_nonces[core]++;
+ } else {
+ if (core >= 0 && core < 16)
+ info->core_nonces[core]++;
+ }
}
struct work *bflsc_work_by_uid(struct cgpu_info *bflsc, struct bflsc_info *sc_info, int id)
@@ -1303,7 +1314,12 @@ static void process_nonces(struct cgpu_info *bflsc, int dev, char *xlink, char *
return;
}
- if (sc_info->que_noncecount != QUE_NONCECOUNT_V1) {
+ if (sc_info->ident == IDENT_BMA) {
+ unsigned int ucore;
+
+ if (sscanf(fields[QUE_CC], "%x", &ucore) == 1)
+ core = ucore;
+ } else if (sc_info->que_noncecount != QUE_NONCECOUNT_V1) {
unsigned int ucore;
if (sscanf(fields[QUE_CHIP_V2], "%x", &ucore) == 1)
@@ -1328,12 +1344,11 @@ static void process_nonces(struct cgpu_info *bflsc, int dev, char *xlink, char *
inc_bflsc_errors(thr, sc_info, core);
}
- if (usb_ident(bflsc) == IDENT_BMA) {
+ if (sc_info->ident == IDENT_BMA) {
int uid;
if (sscanf(fields[QUE_UID], "%04x", &uid) == 1)
work = bflsc_work_by_uid(bflsc, sc_info, uid);
- /* FIXME: Read the QUE_CC field and store stats per cortex */
} else {
char midstate[MIDSTATE_BYTES] = {}, blockdata[MERKLE_BYTES] = {};
@@ -1825,6 +1840,7 @@ static bool bflsc28_queue_full(struct cgpu_info *bflsc)
free(oldbwork);
}
wr_unlock(&bflsc->qlock);
+ sc_info->sc_devs[0].work_queued++;
}
if (queued < created)
ret = true;
@@ -1953,7 +1969,7 @@ static int64_t bflsc_scanwork(struct thr_info *thr)
}
waited = restart_wait(thr, sc_info->scan_sleep_time);
- if (waited == ETIMEDOUT && usb_ident(bflsc) != IDENT_BMA) {
+ if (waited == ETIMEDOUT && sc_info->ident != IDENT_BMA) {
unsigned int old_sleep_time, new_sleep_time = 0;
int min_queued = sc_info->que_size;
/* Only adjust the scan_sleep_time if we did not receive a
@@ -2097,8 +2113,10 @@ static struct api_data *bflsc_api_stats(struct cgpu_info *bflsc)
{
struct bflsc_info *sc_info = (struct bflsc_info *)(bflsc->device_data);
struct api_data *root = NULL;
+ char data[4096];
char buf[256];
- int i;
+ int i, j, off;
+ size_t len;
//if no x-link ... etc
rd_lock(&(sc_info->stat_lock));
@@ -2146,14 +2164,51 @@ else a whole lot of something like these ... etc
root = api_add_volts(root, "X-%d-Vcc2", &(sc_info->vcc2), false);
root = api_add_volts(root, "X-%d-Vmain", &(sc_info->vmain), false);
*/
- if (sc_info->que_noncecount != QUE_NONCECOUNT_V1) {
+ if (sc_info->ident == IDENT_BMA) {
+ for (i = 0; i < 128; i += 16) {
+ data[0] = '\0';
+ off = 0;
+ for (j = 0; j < 16; j++) {
+ len = snprintf(data+off, sizeof(data)-off,
+ "%s%"PRIu64,
+ j > 0 ? " " : "",
+ sc_info->cortex_nonces[i+j]);
+ if (len >= (sizeof(data)-off))
+ off = sizeof(data)-1;
+ else {
+ if (len > 0)
+ off += len;
+ }
+ }
+ sprintf(buf, "Cortex %02x-%02x Nonces", i, i+15);
+ root = api_add_string(root, buf, data, true);
+ }
+ for (i = 0; i < 128; i += 16) {
+ data[0] = '\0';
+ off = 0;
+ for (j = 0; j < 16; j++) {
+ len = snprintf(data+off, sizeof(data)-off,
+ "%s%"PRIu64,
+ j > 0 ? " " : "",
+ sc_info->cortex_hw[i+j]);
+ if (len >= (sizeof(data)-off))
+ off = sizeof(data)-1;
+ else {
+ if (len > 0)
+ off += len;
+ }
+ }
+ sprintf(buf, "Cortex %02x-%02x HW Errors", i, i+15);
+ root = api_add_string(root, buf, data, true);
+ }
+ } else if (sc_info->que_noncecount != QUE_NONCECOUNT_V1) {
for (i = 0; i < 16; i++) {
sprintf(buf, "Core%d Nonces", i);
- root = api_add_int(root, buf, &sc_info->core_nonces[i], false);
+ root = api_add_uint64(root, buf, &sc_info->core_nonces[i], false);
}
for (i = 0; i < 16; i++) {
sprintf(buf, "Core%d HW Errors", i);
- root = api_add_int(root, buf, &sc_info->core_hw[i], false);
+ root = api_add_uint64(root, buf, &sc_info->core_hw[i], false);
}
}
diff --git a/driver-bflsc.h b/driver-bflsc.h
index d7e006c..642a3e9 100644
--- a/driver-bflsc.h
+++ b/driver-bflsc.h
@@ -123,6 +123,7 @@ struct bflsc_work {
};
struct bflsc_info {
+ enum sub_ident ident;
enum driver_version driver_version;
pthread_rwlock_t stat_lock;
struct thr_info results_thr;
@@ -145,13 +146,15 @@ struct bflsc_info {
int que_noncecount;
int que_fld_min;
int que_fld_max;
- int core_nonces[17];
- int core_hw[17];
+ uint64_t core_nonces[17];
+ uint64_t core_hw[17];
int flush_size;
// count of given size, [+2] is for any > QUE_MAX_RESULTS
uint64_t result_size[QUE_MAX_RESULTS+2];
struct bflsc_work *bworks;
+ uint64_t cortex_nonces[0x80];
+ uint64_t cortex_hw[0x80];
};
#define BFLSC_XLINKHDR '@'