Add raw per-core statistics counters which is not averaged per hour
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
diff --git a/driver-knc-spi-fpga.c b/driver-knc-spi-fpga.c
index c91b378..5e9b5ec 100644
--- a/driver-knc-spi-fpga.c
+++ b/driver-knc-spi-fpga.c
@@ -180,6 +180,9 @@ struct knc_state {
unsigned int last_hour_shares_index[MAX_ASICS][256];
unsigned int last_hour_hwerrs_index[MAX_ASICS][256];
+ unsigned int raw_shares[MAX_ASICS][CORES_PER_ASIC];
+ unsigned int raw_hwerrs[MAX_ASICS][CORES_PER_ASIC];
+
pthread_mutex_t lock;
};
@@ -356,6 +359,7 @@ static inline void stats_good_share(struct knc_state *knc, uint32_t asic, uint32
return;
unsigned int cur_minute = (ts->tv_sec / SECONDS_IN_MINUTE) % (KNC_MINUTES_IN_STATS_BUFFER + 1);
stats_update(knc->last_hour_shares[asic][core], &(knc->last_hour_shares_index[asic][core]), cur_minute);
+ knc->raw_shares[asic][core]++;
}
static inline void stats_bad_share(struct knc_state *knc, uint32_t asic, uint32_t core, struct timespec *ts)
@@ -364,6 +368,7 @@ static inline void stats_bad_share(struct knc_state *knc, uint32_t asic, uint32_
return;
unsigned int cur_minute = (ts->tv_sec / SECONDS_IN_MINUTE) % (KNC_MINUTES_IN_STATS_BUFFER + 1);
stats_update(knc->last_hour_hwerrs[asic][core], &(knc->last_hour_hwerrs_index[asic][core]), cur_minute);
+ knc->raw_hwerrs[asic][core]++;
}
static inline unsigned int get_hour_shares(struct knc_state *knc, uint32_t asic, uint32_t core, struct timespec *ts)
@@ -395,6 +400,36 @@ static struct api_data *knc_api_stats(struct cgpu_info *cgpu)
for (asic = 0; asic < MAX_ASICS; ++asic) {
char asic_name[128];
+ snprintf(asic_name, sizeof(asic_name), "asic_%d_raw_shares", asic + 1);
+ cursize = 0;
+ for (core = 0; core < CORES_PER_ASIC; ++core) {
+ n = snprintf(buf + cursize, sizeof(buf) - cursize, "%d,", knc->raw_shares[asic][core]);
+ cursize += n;
+ if (sizeof(buf) < cursize) {
+ cursize = sizeof(buf);
+ break;
+ }
+ }
+ if (0 < cursize)
+ buf[cursize - 1] = '\0'; /* last comma */
+ root = api_add_string(root, asic_name, buf, true);
+
+ snprintf(asic_name, sizeof(asic_name), "asic_%d_raw_hwerrs", asic + 1);
+ cursize = 0;
+ for (core = 0; core < CORES_PER_ASIC; ++core) {
+ n = snprintf(buf + cursize, sizeof(buf) - cursize, "%d,", knc->raw_hwerrs[asic][core]);
+ cursize += n;
+ if (sizeof(buf) < cursize) {
+ cursize = sizeof(buf);
+ break;
+ }
+ }
+ if (0 < cursize)
+ buf[cursize - 1] = '\0'; /* last comma */
+ root = api_add_string(root, asic_name, buf, true);
+ }
+ for (asic = 0; asic < MAX_ASICS; ++asic) {
+ char asic_name[128];
snprintf(asic_name, sizeof(asic_name), "asic_%d_shares", asic + 1);
cursize = 0;
for (core = 0; core < CORES_PER_ASIC; ++core) {