api: add best share diff and last share time
best share diff require --show-diff shown in the "pool" command
This commit is contained in:
parent
e90ade048a
commit
dec6dbed77
9
api.cpp
9
api.cpp
@ -203,6 +203,9 @@ static char *getpoolnfo(char *params)
|
||||
char nonce[128] = { 0 };
|
||||
int pooln = params ? atoi(params) % num_pools : cur_pooln;
|
||||
struct pool_infos *p = &pools[pooln];
|
||||
uint32_t last_share = 0;
|
||||
if (p->last_share_time)
|
||||
last_share = (uint32_t) (time(NULL) - p->last_share_time);
|
||||
|
||||
*s = '\0';
|
||||
|
||||
@ -215,12 +218,12 @@ static char *getpoolnfo(char *params)
|
||||
}
|
||||
|
||||
snprintf(s, MYBUFSIZ, "URL=%s;USER=%s;SOLV=%d;ACC=%d;REJ=%d;H=%u;JOB=%s;DIFF=%.6f;"
|
||||
"N2SZ=%d;N2=%s;PING=%u;DISCO=%u;WAIT=%u;UPTIME=%u|",
|
||||
"BEST=%.6f;N2SZ=%d;N2=%s;PING=%u;DISCO=%u;WAIT=%u;UPTIME=%u;LAST=%u|",
|
||||
p->url, p->type & POOL_STRATUM ? p->user : "",
|
||||
p->solved_count, p->accepted_count, p->rejected_count,
|
||||
stratum.job.height, jobid, stratum_diff,
|
||||
stratum.job.height, jobid, stratum_diff, p->best_share,
|
||||
(int) stratum.xnonce2_size, nonce, stratum.answer_msec,
|
||||
p->disconnects, p->wait_time, p->work_time);
|
||||
p->disconnects, p->wait_time, p->work_time, last_share);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ function translateField($key)
|
||||
$intl['ACCMN'] = 'Accepted / mn';
|
||||
$intl['REJ'] = 'Rejected';
|
||||
$intl['SOLV'] = 'Solved';
|
||||
$intl['BEST'] = 'Best share';
|
||||
$intl['LAST'] = 'Last share';
|
||||
$intl['DIFF'] = 'Difficulty';
|
||||
$intl['NETKHS'] = 'Net Rate';
|
||||
$intl['UPTIME'] = 'Miner up time';
|
||||
@ -54,7 +56,6 @@ function translateField($key)
|
||||
$intl['THR'] = 'Throughput';
|
||||
$intl['WAIT'] = 'Wait time';
|
||||
|
||||
|
||||
$intl['H'] = 'Bloc height';
|
||||
$intl['I'] = 'Intensity';
|
||||
$intl['HWF'] = 'Failures';
|
||||
|
@ -659,13 +659,16 @@ static int share_result(int result, int pooln, double sharediff, const char *rea
|
||||
struct pool_infos *p = &pools[pooln];
|
||||
|
||||
pthread_mutex_lock(&stats_lock);
|
||||
|
||||
for (int i = 0; i < opt_n_threads; i++) {
|
||||
hashrate += stats_get_speed(i, thr_hashrates[i]);
|
||||
}
|
||||
pthread_mutex_unlock(&stats_lock);
|
||||
|
||||
result ? p->accepted_count++ : p->rejected_count++;
|
||||
pthread_mutex_unlock(&stats_lock);
|
||||
|
||||
p->last_share_time = time(NULL);
|
||||
if (sharediff > p->best_share)
|
||||
p->best_share = sharediff;
|
||||
|
||||
global_hashrate = llround(hashrate);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user