Browse Source

API - Add last share difficulty for devices and pool

nfactor-troky
Kano 12 years ago
parent
commit
a6bf276f6b
  1. 14
      API-README
  2. 4
      api.c
  3. 2
      cgminer.c
  4. 2
      miner.h

14
API-README

@ -392,13 +392,15 @@ Added API commands:
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', 'Difficulty Accepted', 'Difficulty Rejected' 'devs' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected',
to all devices 'Last Share Difficulty' to all devices
'gpu|N' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected' 'gpu|N' - add 'Diff1 Work', 'Difficulty Accepted',
'pga|N' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected' 'Difficulty Rejected', 'Last Share Difficulty'
'pga|N' - add 'Diff1 Work', 'Difficulty Accepted',
'Difficulty Rejected', 'Last Share Difficulty'
'notify' - add '*Dev Throttle' (for BFL Singles) 'notify' - add '*Dev Throttle' (for BFL Singles)
'pools' - add 'Proxy Type', 'Proxy', 'Difficulty Accepted', 'pools' - add 'Proxy Type', 'Proxy', 'Difficulty Accepted', 'Difficulty Rejected',
'Difficulty Rejected', 'Difficulty Stale' 'Difficulty Stale', 'Last Share Difficulty'
'config' - add 'Queue', 'Expiry' 'config' - add 'Queue', 'Expiry'
---------- ----------

4
api.c

@ -1387,6 +1387,7 @@ static void gpustatus(int gpu, bool isjson)
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 Accepted", &(cgpu->diff_accepted), false);
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false); root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
root = print_data(root, buf, isjson); root = print_data(root, buf, isjson);
strcat(io_buffer, buf); strcat(io_buffer, buf);
@ -1473,6 +1474,7 @@ static void pgastatus(int pga, bool isjson)
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 Accepted", &(cgpu->diff_accepted), false);
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false); root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
root = print_data(root, buf, isjson); root = print_data(root, buf, isjson);
strcat(io_buffer, buf); strcat(io_buffer, buf);
@ -1508,6 +1510,7 @@ static void cpustatus(int cpu, bool isjson)
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 Accepted", &(cgpu->diff_accepted), false);
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false); root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
root = print_data(root, buf, isjson); root = print_data(root, buf, isjson);
strcat(io_buffer, buf); strcat(io_buffer, buf);
@ -1890,6 +1893,7 @@ static void poolstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
root = api_add_diff(root, "Difficulty Accepted", &(pool->diff_accepted), 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 Rejected", &(pool->diff_rejected), false);
root = api_add_diff(root, "Difficulty Stale", &(pool->diff_stale), false); root = api_add_diff(root, "Difficulty Stale", &(pool->diff_stale), false);
root = api_add_diff(root, "Last Share Difficulty", &(pool->last_share_diff), false);
if (isjson && (i > 0)) if (isjson && (i > 0))
strcat(io_buffer, COMMA); strcat(io_buffer, COMMA);

2
cgminer.c

@ -1877,7 +1877,9 @@ static bool submit_upstream_work(const struct work *work, CURL *curl, bool resub
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);
cgpu->last_share_diff = work->work_difficulty;
pool->last_share_time = cgpu->last_share_pool_time; pool->last_share_time = cgpu->last_share_pool_time;
pool->last_share_diff = work->work_difficulty;
applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)"); applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)");
if (!QUIET) { if (!QUIET) {
if (total_pools > 1) if (total_pools > 1)

2
miner.h

@ -405,6 +405,7 @@ struct cgpu_info {
double diff_rejected; double diff_rejected;
int last_share_pool; int last_share_pool;
time_t last_share_pool_time; time_t last_share_pool_time;
double last_share_diff;
time_t device_last_well; time_t device_last_well;
time_t device_last_not_well; time_t device_last_not_well;
@ -800,6 +801,7 @@ struct pool {
struct list_head curlring; struct list_head curlring;
time_t last_share_time; time_t last_share_time;
double last_share_diff;
struct cgminer_stats cgminer_stats; struct cgminer_stats cgminer_stats;
struct cgminer_pool_stats cgminer_pool_stats; struct cgminer_pool_stats cgminer_pool_stats;

Loading…
Cancel
Save