Store and report Accepted,Rejected,Stale difficulty in the summary and 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 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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
diff --git a/API-README b/API-README
index 1fa904d..ad89b1f 100644
--- a/API-README
+++ b/API-README
@@ -387,16 +387,18 @@ API V1.19
Added API commands:
'debug'
- 'pgaidentify|N'
+ 'pgaidentify|N' (only works for BFL Singles so far)
'setconfig|name,N'
Modified API commands:
Change pool field name 'Diff1 Shares' to 'Diff1 Work'
- 'devs' - add 'Diff1 Work' to all devices
- 'gpu|N' - add 'Diff1 Work'
- 'pga|N' - add 'Diff1 Work'
+ 'devs' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected'
+ to all devices
+ 'gpu|N' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected'
+ 'pga|N' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected'
'notify' - add '*Dev Throttle' (for BFL Singles)
- 'pools' - add 'Proxy Type', 'Proxy'
+ 'pools' - add 'Proxy Type', 'Proxy', 'Difficulty Accepted',
+ 'Difficulty Rejected', 'Difficulty Stale'
'config' - add 'Queue', 'Expiry'
----------
diff --git a/api.c b/api.c
index 01660af..9b4e017 100644
--- a/api.c
+++ b/api.c
@@ -776,6 +776,7 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu
case API_UTILITY:
case API_FREQ:
case API_HS:
+ case API_DIFF:
api_data->data = (void *)malloc(sizeof(double));
*((double *)(api_data->data)) = *((double *)data);
break;
@@ -902,6 +903,11 @@ struct api_data *api_add_hs(struct api_data *root, char *name, double *data, boo
return api_add_data_full(root, name, API_HS, (void *)data, copy_data);
}
+struct api_data *api_add_diff(struct api_data *root, char *name, double *data, bool copy_data)
+{
+ return api_add_data_full(root, name, API_DIFF, (void *)data, copy_data);
+}
+
static struct api_data *print_data(struct api_data *root, char *buf, bool isjson)
{
struct api_data *tmp;
@@ -973,6 +979,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
case API_HS:
sprintf(buf, "%.15f", *((double *)(root->data)));
break;
+ case API_DIFF:
+ sprintf(buf, "%.8f", *((double *)(root->data)));
+ break;
case API_BOOL:
sprintf(buf, "%s", *((bool *)(root->data)) ? TRUESTR : FALSESTR);
break;
@@ -1376,6 +1385,8 @@ static void gpustatus(int gpu, bool isjson)
root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false);
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false);
+ root = api_add_diff(root, "Difficulty Accepted", &(cgpu->diff_accepted), false);
+ root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
root = print_data(root, buf, isjson);
strcat(io_buffer, buf);
@@ -1460,6 +1471,8 @@ static void pgastatus(int pga, bool isjson)
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
root = api_add_freq(root, "Frequency", &frequency, false);
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false);
+ root = api_add_diff(root, "Difficulty Accepted", &(cgpu->diff_accepted), false);
+ root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
root = print_data(root, buf, isjson);
strcat(io_buffer, buf);
@@ -1493,6 +1506,8 @@ static void cpustatus(int cpu, bool isjson)
root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false);
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false);
+ root = api_add_diff(root, "Difficulty Accepted", &(cgpu->diff_accepted), false);
+ root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
root = print_data(root, buf, isjson);
strcat(io_buffer, buf);
@@ -1872,6 +1887,9 @@ static void poolstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
root = api_add_const(root, "Proxy Type", BLANK, false);
root = api_add_const(root, "Proxy", BLANK, false);
}
+ root = api_add_diff(root, "Difficulty Accepted", &(pool->diff_accepted), false);
+ root = api_add_diff(root, "Difficulty Rejected", &(pool->diff_rejected), false);
+ root = api_add_diff(root, "Difficulty Stale", &(pool->diff_stale), false);
if (isjson && (i > 0))
strcat(io_buffer, COMMA);
@@ -1924,6 +1942,9 @@ static void summary(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, boo
root = api_add_uint(root, "Network Blocks", &(new_blocks), false);
root = api_add_mhtotal(root, "Total MH", &(total_mhashes_done), false);
root = api_add_utility(root, "Work Utility", &(work_utility), false);
+ root = api_add_diff(root, "Difficulty Accepted", &(total_diff_accepted), false);
+ root = api_add_diff(root, "Difficulty Rejected", &(total_diff_rejected), false);
+ root = api_add_diff(root, "Difficulty Stale", &(total_diff_stale), false);
root = print_data(root, buf, isjson);
if (isjson)
diff --git a/cgminer.c b/cgminer.c
index 4ad666d..cb61958 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -187,6 +187,7 @@ pthread_mutex_t control_lock;
int hw_errors;
int total_accepted, total_rejected, total_diff1;
int total_getworks, total_stale, total_discarded;
+double total_diff_accepted, total_diff_rejected, total_diff_stale;
static int total_queued, staged_rollable;
unsigned int new_blocks;
static unsigned int work_block;
@@ -1870,6 +1871,9 @@ static bool submit_upstream_work(const struct work *work, CURL *curl, bool resub
cgpu->accepted++;
total_accepted++;
pool->accepted++;
+ cgpu->diff_accepted += work->work_difficulty;
+ total_diff_accepted += work->work_difficulty;
+ pool->diff_accepted += work->work_difficulty;
pool->seq_rejects = 0;
cgpu->last_share_pool = pool->pool_no;
cgpu->last_share_pool_time = time(NULL);
@@ -1903,6 +1907,9 @@ static bool submit_upstream_work(const struct work *work, CURL *curl, bool resub
cgpu->rejected++;
total_rejected++;
pool->rejected++;
+ cgpu->diff_rejected += work->work_difficulty;
+ total_diff_rejected += work->work_difficulty;
+ pool->diff_rejected += work->work_difficulty;
pool->seq_rejects++;
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
if (!QUIET) {
@@ -2621,6 +2628,8 @@ static void *submit_work_thread(void *userdata)
sharelog("discard", work);
total_stale++;
pool->stale_shares++;
+ total_diff_stale += work->work_difficulty;
+ pool->diff_stale += work->work_difficulty;
goto out;
}
work->stale = true;
@@ -2634,6 +2643,8 @@ static void *submit_work_thread(void *userdata)
applog(LOG_NOTICE, "Share became stale while retrying submit, discarding");
total_stale++;
pool->stale_shares++;
+ total_diff_stale += work->work_difficulty;
+ pool->diff_stale += work->work_difficulty;
break;
}
@@ -3080,6 +3091,8 @@ static void display_pool_summary(struct pool *pool)
wlog(" Share submissions: %d\n", pool->accepted + pool->rejected);
wlog(" Accepted shares: %d\n", pool->accepted);
wlog(" Rejected shares: %d\n", pool->rejected);
+ wlog(" Accepted difficulty shares: %1.f\n", pool->diff_accepted);
+ wlog(" Rejected difficulty shares: %1.f\n", pool->diff_rejected);
if (pool->accepted || pool->rejected)
wlog(" Reject ratio: %.1f%%\n", (double)(pool->rejected * 100) / (double)(pool->accepted + pool->rejected));
efficiency = pool->getwork_requested ? pool->accepted * 100.0 / pool->getwork_requested : 0.0;
@@ -4996,6 +5009,8 @@ static void print_summary(void)
applog(LOG_WARNING, "Share submissions: %d", total_accepted + total_rejected);
applog(LOG_WARNING, "Accepted shares: %d", total_accepted);
applog(LOG_WARNING, "Rejected shares: %d", total_rejected);
+ applog(LOG_WARNING, "Accepted difficulty shares: %1.f", total_diff_accepted);
+ applog(LOG_WARNING, "Rejected difficulty shares: %1.f", total_diff_rejected);
if (total_accepted || total_rejected)
applog(LOG_WARNING, "Reject ratio: %.1f%%", (double)(total_rejected * 100) / (double)(total_accepted + total_rejected));
applog(LOG_WARNING, "Hardware errors: %d", hw_errors);
@@ -5021,6 +5036,8 @@ static void print_summary(void)
applog(LOG_WARNING, " Share submissions: %d", pool->accepted + pool->rejected);
applog(LOG_WARNING, " Accepted shares: %d", pool->accepted);
applog(LOG_WARNING, " Rejected shares: %d", pool->rejected);
+ applog(LOG_WARNING, " Accepted difficulty shares: %1.f", pool->diff_accepted);
+ applog(LOG_WARNING, " Rejected difficulty shares: %1.f", pool->diff_rejected);
if (pool->accepted || pool->rejected)
applog(LOG_WARNING, " Reject ratio: %.1f%%", (double)(pool->rejected * 100) / (double)(pool->accepted + pool->rejected));
efficiency = pool->getwork_requested ? pool->accepted * 100.0 / pool->getwork_requested : 0.0;
diff --git a/miner.h b/miner.h
index f3e9303..b94645e 100644
--- a/miner.h
+++ b/miner.h
@@ -401,6 +401,8 @@ struct cgpu_info {
float gpu_vddc;
#endif
int diff1;
+ double diff_accepted;
+ double diff_rejected;
int last_share_pool;
time_t last_share_pool_time;
@@ -684,6 +686,7 @@ extern unsigned int new_blocks;
extern unsigned int found_blocks;
extern int total_accepted, total_rejected, total_diff1;;
extern int total_getworks, total_stale, total_discarded;
+extern double total_diff_accepted, total_diff_rejected, total_diff_stale;
extern unsigned int local_work;
extern unsigned int total_go, total_ro;
extern const int opt_cutofftemp;
@@ -748,6 +751,10 @@ struct pool {
int solved;
int diff1;
+ double diff_accepted;
+ double diff_rejected;
+ double diff_stale;
+
int queued;
int staged;
@@ -906,7 +913,8 @@ enum api_data_type {
API_UTILITY,
API_FREQ,
API_VOLTS,
- API_HS
+ API_HS,
+ API_DIFF
};
struct api_data {
@@ -937,5 +945,6 @@ extern struct api_data *api_add_utility(struct api_data *root, char *name, doubl
extern struct api_data *api_add_freq(struct api_data *root, char *name, double *data, bool copy_data);
extern struct api_data *api_add_volts(struct api_data *root, char *name, float *data, bool copy_data);
extern struct api_data *api_add_hs(struct api_data *root, char *name, double *data, bool copy_data);
+extern struct api_data *api_add_diff(struct api_data *root, char *name, double *data, bool copy_data);
#endif /* __MINER_H__ */