diff --git a/api.cpp b/api.cpp index 282f9d1..6d09f1d 100644 --- a/api.cpp +++ b/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; } diff --git a/api/index.php b/api/index.php index 5815970..63f37c1 100644 --- a/api/index.php +++ b/api/index.php @@ -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'; diff --git a/ccminer.cpp b/ccminer.cpp index 38c626a..25e640c 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -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); diff --git a/miner.h b/miner.h index 8fc526a..9c53b35 100644 --- a/miner.h +++ b/miner.h @@ -678,6 +678,8 @@ struct pool_infos { uint32_t accepted_count; uint32_t rejected_count; uint32_t solved_count; + time_t last_share_time; + double best_share; uint32_t disconnects; };