Convert the hfa hashmeter to one based on successful share return and display the raw and calculated hash totals in the API.
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
diff --git a/driver-hashfast.c b/driver-hashfast.c
index 89d3520..cc8088e 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -604,7 +604,7 @@ static void hfa_parse_gwq_status(struct cgpu_info *hashfast, struct hashfast_inf
}
mutex_lock(&info->lock);
- info->hash_count += g->hash_count;
+ info->raw_hashes += g->hash_count;
info->device_sequence_head = g->sequence_head;
info->device_sequence_tail = g->sequence_tail;
info->shed_count = g->shed_count;
@@ -704,7 +704,11 @@ static void hfa_parse_nonce(struct thr_info *thr, struct cgpu_info *hashfast,
} else {
applog(LOG_DEBUG, "HFA %d: OP_NONCE: sequence %d: submitting nonce 0x%08x ntime %d",
hashfast->device_id, n->sequence, n->nonce, n->ntime & HF_NTIME_MASK);
- submit_noffset_nonce(thr, work, n->nonce, n->ntime & HF_NTIME_MASK); // XXX Return value from submit_nonce is error if set
+ if (submit_noffset_nonce(thr, work, n->nonce, n->ntime & HF_NTIME_MASK)) {
+ mutex_lock(&info->lock);
+ info->hash_count += 0xffffffffull * (uint64_t)work->work_difficulty;
+ mutex_unlock(&info->lock);
+ }
#if 0 /* Not used */
if (unlikely(n->ntime & HF_NONCE_SEARCH)) {
/* This tells us there is another share in the
@@ -988,6 +992,7 @@ restart:
mutex_lock(&info->lock);
hashes = info->hash_count;
+ info->calc_hashes += hashes;
info->hash_count = 0;
mutex_unlock(&info->lock);
@@ -1060,6 +1065,9 @@ static struct api_data *hfa_api_stats(struct cgpu_info *cgpu)
root = api_add_uint64(root, "stats overrun", &l->stats_overrun, false);
}
+ root = api_add_uint64(root, "raw hashcount", &info->raw_hashes, false);
+ root = api_add_uint64(root, "calc hashcount", &info->calc_hashes, false);
+
return root;
}
diff --git a/driver-hashfast.h b/driver-hashfast.h
index c6cc46e..9e634b6 100644
--- a/driver-hashfast.h
+++ b/driver-hashfast.h
@@ -94,6 +94,8 @@ struct hashfast_info {
uint16_t device_sequence_head; // DEVICE: The most recent sequence number the device dispatched
uint16_t device_sequence_tail; // DEVICE: The most recently completed job in the device
int64_t hash_count;
+ uint64_t raw_hashes;
+ uint64_t calc_hashes;
uint16_t shed_count; // Dynamic copy of #cores device has shed for thermal control
int no_matching_work;