Browse Source

Store and report Accepted,Rejected,Stale difficulty in the summary and API

nfactor-troky
Kano 12 years ago
parent
commit
89b6989fb3
  1. 12
      API-README
  2. 21
      api.c
  3. 17
      cgminer.c
  4. 11
      miner.h

12
API-README

@ -387,16 +387,18 @@ API V1.19
Added API commands: Added API commands:
'debug' 'debug'
'pgaidentify|N' 'pgaidentify|N' (only works for BFL Singles so far)
'setconfig|name,N' 'setconfig|name,N'
Modified API commands: Modified API commands:
Change pool field name 'Diff1 Shares' to 'Diff1 Work' Change pool field name 'Diff1 Shares' to 'Diff1 Work'
'devs' - add 'Diff1 Work' to all devices 'devs' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected'
'gpu|N' - add 'Diff1 Work' to all devices
'pga|N' - add 'Diff1 Work' '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) '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' 'config' - add 'Queue', 'Expiry'
---------- ----------

21
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_UTILITY:
case API_FREQ: case API_FREQ:
case API_HS: case API_HS:
case API_DIFF:
api_data->data = (void *)malloc(sizeof(double)); api_data->data = (void *)malloc(sizeof(double));
*((double *)(api_data->data)) = *((double *)data); *((double *)(api_data->data)) = *((double *)data);
break; 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); 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) static struct api_data *print_data(struct api_data *root, char *buf, bool isjson)
{ {
struct api_data *tmp; 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: case API_HS:
sprintf(buf, "%.15f", *((double *)(root->data))); sprintf(buf, "%.15f", *((double *)(root->data)));
break; break;
case API_DIFF:
sprintf(buf, "%.8f", *((double *)(root->data)));
break;
case API_BOOL: case API_BOOL:
sprintf(buf, "%s", *((bool *)(root->data)) ? TRUESTR : FALSESTR); sprintf(buf, "%s", *((bool *)(root->data)) ? TRUESTR : FALSESTR);
break; 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_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_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), 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); root = print_data(root, buf, isjson);
strcat(io_buffer, buf); 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_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
root = api_add_freq(root, "Frequency", &frequency, false); root = api_add_freq(root, "Frequency", &frequency, false);
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), 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); root = print_data(root, buf, isjson);
strcat(io_buffer, buf); 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_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_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), 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); root = print_data(root, buf, isjson);
strcat(io_buffer, buf); 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 Type", BLANK, false);
root = api_add_const(root, "Proxy", 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)) if (isjson && (i > 0))
strcat(io_buffer, COMMA); 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_uint(root, "Network Blocks", &(new_blocks), false);
root = api_add_mhtotal(root, "Total MH", &(total_mhashes_done), 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_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); root = print_data(root, buf, isjson);
if (isjson) if (isjson)

17
cgminer.c

@ -187,6 +187,7 @@ pthread_mutex_t control_lock;
int hw_errors; int hw_errors;
int total_accepted, total_rejected, total_diff1; int total_accepted, total_rejected, total_diff1;
int total_getworks, total_stale, total_discarded; int total_getworks, total_stale, total_discarded;
double total_diff_accepted, total_diff_rejected, total_diff_stale;
static int total_queued, staged_rollable; static int total_queued, staged_rollable;
unsigned int new_blocks; unsigned int new_blocks;
static unsigned int work_block; static unsigned int work_block;
@ -1870,6 +1871,9 @@ static bool submit_upstream_work(const struct work *work, CURL *curl, bool resub
cgpu->accepted++; cgpu->accepted++;
total_accepted++; total_accepted++;
pool->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; pool->seq_rejects = 0;
cgpu->last_share_pool = pool->pool_no; cgpu->last_share_pool = pool->pool_no;
cgpu->last_share_pool_time = time(NULL); 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++; cgpu->rejected++;
total_rejected++; total_rejected++;
pool->rejected++; pool->rejected++;
cgpu->diff_rejected += work->work_difficulty;
total_diff_rejected += work->work_difficulty;
pool->diff_rejected += work->work_difficulty;
pool->seq_rejects++; pool->seq_rejects++;
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)"); applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
if (!QUIET) { if (!QUIET) {
@ -2621,6 +2628,8 @@ static void *submit_work_thread(void *userdata)
sharelog("discard", work); sharelog("discard", work);
total_stale++; total_stale++;
pool->stale_shares++; pool->stale_shares++;
total_diff_stale += work->work_difficulty;
pool->diff_stale += work->work_difficulty;
goto out; goto out;
} }
work->stale = true; work->stale = true;
@ -2634,6 +2643,8 @@ static void *submit_work_thread(void *userdata)
applog(LOG_NOTICE, "Share became stale while retrying submit, discarding"); applog(LOG_NOTICE, "Share became stale while retrying submit, discarding");
total_stale++; total_stale++;
pool->stale_shares++; pool->stale_shares++;
total_diff_stale += work->work_difficulty;
pool->diff_stale += work->work_difficulty;
break; break;
} }
@ -3080,6 +3091,8 @@ static void display_pool_summary(struct pool *pool)
wlog(" Share submissions: %d\n", pool->accepted + pool->rejected); wlog(" Share submissions: %d\n", pool->accepted + pool->rejected);
wlog(" Accepted shares: %d\n", pool->accepted); wlog(" Accepted shares: %d\n", pool->accepted);
wlog(" Rejected shares: %d\n", pool->rejected); 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) if (pool->accepted || pool->rejected)
wlog(" Reject ratio: %.1f%%\n", (double)(pool->rejected * 100) / (double)(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; 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, "Share submissions: %d", total_accepted + total_rejected);
applog(LOG_WARNING, "Accepted shares: %d", total_accepted); applog(LOG_WARNING, "Accepted shares: %d", total_accepted);
applog(LOG_WARNING, "Rejected shares: %d", total_rejected); 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) if (total_accepted || total_rejected)
applog(LOG_WARNING, "Reject ratio: %.1f%%", (double)(total_rejected * 100) / (double)(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); 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, " Share submissions: %d", pool->accepted + pool->rejected);
applog(LOG_WARNING, " Accepted shares: %d", pool->accepted); applog(LOG_WARNING, " Accepted shares: %d", pool->accepted);
applog(LOG_WARNING, " Rejected shares: %d", pool->rejected); 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) if (pool->accepted || pool->rejected)
applog(LOG_WARNING, " Reject ratio: %.1f%%", (double)(pool->rejected * 100) / (double)(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; efficiency = pool->getwork_requested ? pool->accepted * 100.0 / pool->getwork_requested : 0.0;

11
miner.h

@ -401,6 +401,8 @@ struct cgpu_info {
float gpu_vddc; float gpu_vddc;
#endif #endif
int diff1; int diff1;
double diff_accepted;
double diff_rejected;
int last_share_pool; int last_share_pool;
time_t last_share_pool_time; time_t last_share_pool_time;
@ -684,6 +686,7 @@ extern unsigned int new_blocks;
extern unsigned int found_blocks; extern unsigned int found_blocks;
extern int total_accepted, total_rejected, total_diff1;; extern int total_accepted, total_rejected, total_diff1;;
extern int total_getworks, total_stale, total_discarded; 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 local_work;
extern unsigned int total_go, total_ro; extern unsigned int total_go, total_ro;
extern const int opt_cutofftemp; extern const int opt_cutofftemp;
@ -748,6 +751,10 @@ struct pool {
int solved; int solved;
int diff1; int diff1;
double diff_accepted;
double diff_rejected;
double diff_stale;
int queued; int queued;
int staged; int staged;
@ -906,7 +913,8 @@ enum api_data_type {
API_UTILITY, API_UTILITY,
API_FREQ, API_FREQ,
API_VOLTS, API_VOLTS,
API_HS API_HS,
API_DIFF
}; };
struct api_data { 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_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_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_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__ */ #endif /* __MINER_H__ */

Loading…
Cancel
Save