mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Work out a rolling average getwork delay stored in pool_stats.
This commit is contained in:
parent
4e60a62ae2
commit
f32ffb8718
5
api.c
5
api.c
@ -2114,11 +2114,12 @@ static int itemstats(int i, char *id, struct cgminer_stats *stats, struct cgmine
|
||||
if (pool_stats) {
|
||||
sprintf(buf, isjson
|
||||
? ",\"Pool Calls\":%d,\"Pool Attempts\":%d,\"Pool Wait\":%ld.%06ld,\"Pool Max\":%ld.%06ld,\"Pool Min\":%ld.%06ld"
|
||||
: ",Pool Calls=%d,Pool Attempts=%d,Pool Wait=%ld.%06ld,Pool Max=%ld.%06ld,Pool Min=%ld.%06ld",
|
||||
: ",Pool Calls=%d,Pool Attempts=%d,Pool Wait=%ld.%06ld,Pool Max=%ld.%06ld,Pool Min=%ld.%06ld,Pool Av=%f",
|
||||
pool_stats->getwork_calls, pool_stats->getwork_attempts,
|
||||
pool_stats->getwork_wait.tv_sec, pool_stats->getwork_wait.tv_usec,
|
||||
pool_stats->getwork_wait_max.tv_sec, pool_stats->getwork_wait_max.tv_usec,
|
||||
pool_stats->getwork_wait_min.tv_sec, pool_stats->getwork_wait_min.tv_usec);
|
||||
pool_stats->getwork_wait_min.tv_sec, pool_stats->getwork_wait_min.tv_usec,
|
||||
pool_stats->getwork_wait_rolling);
|
||||
|
||||
strcat(io_buffer, buf);
|
||||
}
|
||||
|
13
cgminer.c
13
cgminer.c
@ -1856,13 +1856,11 @@ retry:
|
||||
if (!rc && retries < 3)
|
||||
goto retry;
|
||||
|
||||
work->pool = pool;
|
||||
work->longpoll = false;
|
||||
total_getworks++;
|
||||
pool->getwork_requested++;
|
||||
|
||||
gettimeofday(&tv_end, NULL);
|
||||
timersub(&tv_end, &tv_start, &tv_elapsed);
|
||||
pool_stats->getwork_wait_rolling += ((double)tv_elapsed.tv_sec + ((double)tv_elapsed.tv_usec / 1000000)) * 0.63;
|
||||
pool_stats->getwork_wait_rolling /= 1.63;
|
||||
|
||||
timeradd(&tv_elapsed, &(pool_stats->getwork_wait), &(pool_stats->getwork_wait));
|
||||
if (timercmp(&tv_elapsed, &(pool_stats->getwork_wait_max), >)) {
|
||||
pool_stats->getwork_wait_max.tv_sec = tv_elapsed.tv_sec;
|
||||
@ -1874,6 +1872,11 @@ retry:
|
||||
}
|
||||
pool_stats->getwork_calls++;
|
||||
|
||||
work->pool = pool;
|
||||
work->longpoll = false;
|
||||
total_getworks++;
|
||||
pool->getwork_requested++;
|
||||
|
||||
json_decref(val);
|
||||
out:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user