Browse Source

Work out a rolling average getwork delay stored in pool_stats.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
f32ffb8718
  1. 5
      api.c
  2. 13
      cgminer.c
  3. 1
      miner.h

5
api.c

@ -2114,11 +2114,12 @@ static int itemstats(int i, char *id, struct cgminer_stats *stats, struct cgmine
if (pool_stats) { if (pool_stats) {
sprintf(buf, isjson 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 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_calls, pool_stats->getwork_attempts,
pool_stats->getwork_wait.tv_sec, pool_stats->getwork_wait.tv_usec, 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_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); strcat(io_buffer, buf);
} }

13
cgminer.c

@ -1856,13 +1856,11 @@ retry:
if (!rc && retries < 3) if (!rc && retries < 3)
goto retry; goto retry;
work->pool = pool;
work->longpoll = false;
total_getworks++;
pool->getwork_requested++;
gettimeofday(&tv_end, NULL); gettimeofday(&tv_end, NULL);
timersub(&tv_end, &tv_start, &tv_elapsed); 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)); timeradd(&tv_elapsed, &(pool_stats->getwork_wait), &(pool_stats->getwork_wait));
if (timercmp(&tv_elapsed, &(pool_stats->getwork_wait_max), >)) { if (timercmp(&tv_elapsed, &(pool_stats->getwork_wait_max), >)) {
pool_stats->getwork_wait_max.tv_sec = tv_elapsed.tv_sec; pool_stats->getwork_wait_max.tv_sec = tv_elapsed.tv_sec;
@ -1874,6 +1872,11 @@ retry:
} }
pool_stats->getwork_calls++; pool_stats->getwork_calls++;
work->pool = pool;
work->longpoll = false;
total_getworks++;
pool->getwork_requested++;
json_decref(val); json_decref(val);
out: out:

1
miner.h

@ -298,6 +298,7 @@ struct cgminer_pool_stats {
struct timeval getwork_wait; struct timeval getwork_wait;
struct timeval getwork_wait_max; struct timeval getwork_wait_max;
struct timeval getwork_wait_min; struct timeval getwork_wait_min;
double getwork_wait_rolling;
}; };
struct cgpu_info { struct cgpu_info {

Loading…
Cancel
Save