noncedup - give access to the internal 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
diff --git a/miner.h b/miner.h
index 2e24952..d9d5da1 100644
--- a/miner.h
+++ b/miner.h
@@ -1558,6 +1558,7 @@ extern struct api_data *api_add_percent(struct api_data *root, char *name, doubl
extern struct api_data *api_add_avg(struct api_data *root, char *name, float *data, bool copy_data);
extern void dupalloc(struct cgpu_info *cgpu, int timelimit);
+extern void dupcounters(struct cgpu_info *cgpu, uint64_t *checked, uint64_t *dups);
extern bool isdupnonce(struct cgpu_info *cgpu, struct work *work, uint32_t nonce);
#endif /* __MINER_H__ */
diff --git a/noncedup.c b/noncedup.c
index 3479f82..6b94fd6 100644
--- a/noncedup.c
+++ b/noncedup.c
@@ -24,7 +24,7 @@ struct dupdata {
K_LIST *nfree_list;
K_STORE *nonce_list;
uint64_t checked;
- uint64_t dup;
+ uint64_t dups;
};
void dupalloc(struct cgpu_info *cgpu, int timelimit)
@@ -42,6 +42,19 @@ void dupalloc(struct cgpu_info *cgpu, int timelimit)
cgpu->dup_data = dup;
}
+void dupcounters(struct cgpu_info *cgpu, uint64_t *checked, uint64_t *dups)
+{
+ struct dupdata *dup = (struct dupdata *)(cgpu->dup_data);
+
+ if (!dup) {
+ *checked = 0;
+ *dups = 0;
+ } else {
+ *checked = dup->checked;
+ *dups = dup->dups;
+ }
+}
+
bool isdupnonce(struct cgpu_info *cgpu, struct work *work, uint32_t nonce)
{
struct dupdata *dup = (struct dupdata *)(cgpu->dup_data);
@@ -80,7 +93,7 @@ bool isdupnonce(struct cgpu_info *cgpu, struct work *work, uint32_t nonce)
K_WUNLOCK(dup->nfree_list);
if (!unique)
- dup->dup++;
+ dup->dups++;
return !unique;
}