Browse Source

Simplify all those total_secs usages by initialising it to 1 second.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
afcfea15a7
  1. 13
      cgminer.c

13
cgminer.c

@ -1367,7 +1367,7 @@ static int pool_staged(struct pool *pool)
#ifdef HAVE_CURSES #ifdef HAVE_CURSES
WINDOW *mainwin, *statuswin, *logwin; WINDOW *mainwin, *statuswin, *logwin;
#endif #endif
double total_secs = 0.1; double total_secs = 1.0;
static char statusline[256]; static char statusline[256];
/* logstart is where the log window should start */ /* logstart is where the log window should start */
static int devcursor, logstart, logcursor; static int devcursor, logstart, logcursor;
@ -1508,7 +1508,7 @@ static void curses_print_devstatus(int thr_id)
if (devcursor + cgpu->cgminer_id > LINES - 2) if (devcursor + cgpu->cgminer_id > LINES - 2)
return; return;
cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60; cgpu->utility = cgpu->accepted / total_secs * 60;
wmove(statuswin,devcursor + cgpu->cgminer_id, 0); wmove(statuswin,devcursor + cgpu->cgminer_id, 0);
wprintw(statuswin, " %s %*d: ", cgpu->api->name, dev_width, cgpu->device_id); wprintw(statuswin, " %s %*d: ", cgpu->api->name, dev_width, cgpu->device_id);
@ -1889,7 +1889,7 @@ static bool submit_upstream_work(const struct work *work, CURL *curl)
* be stale due to networking delays. * be stale due to networking delays.
*/ */
if (pool->seq_rejects > 10 && !work->stale && opt_disable_pool && enabled_pools > 1) { if (pool->seq_rejects > 10 && !work->stale && opt_disable_pool && enabled_pools > 1) {
double utility = total_accepted / ( total_secs ? total_secs : 1 ) * 60; double utility = total_accepted / total_secs * 60;
if (pool->seq_rejects > utility * 3) { if (pool->seq_rejects > utility * 3) {
applog(LOG_WARNING, "Pool %d rejected %d sequential shares, disabling!", applog(LOG_WARNING, "Pool %d rejected %d sequential shares, disabling!",
@ -1902,7 +1902,7 @@ static bool submit_upstream_work(const struct work *work, CURL *curl)
} }
} }
cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60; cgpu->utility = cgpu->accepted / total_secs * 60;
if (!opt_realquiet) if (!opt_realquiet)
print_status(thr_id); print_status(thr_id);
@ -3768,7 +3768,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
total_secs = (double)total_diff.tv_sec + total_secs = (double)total_diff.tv_sec +
((double)total_diff.tv_usec / 1000000.0); ((double)total_diff.tv_usec / 1000000.0);
utility = total_accepted / ( total_secs ? total_secs : 1 ) * 60; utility = total_accepted / total_secs * 60;
efficiency = total_getworks ? total_accepted * 100.0 / total_getworks : 0.0; efficiency = total_getworks ? total_accepted * 100.0 / total_getworks : 0.0;
displayed_hashes = total_mhashes_done / total_secs; displayed_hashes = total_mhashes_done / total_secs;
@ -4862,7 +4862,7 @@ static void print_summary(void)
mins = (diff.tv_sec % 3600) / 60; mins = (diff.tv_sec % 3600) / 60;
secs = diff.tv_sec % 60; secs = diff.tv_sec % 60;
utility = total_accepted / ( total_secs ? total_secs : 1 ) * 60; utility = total_accepted / total_secs * 60;
efficiency = total_getworks ? total_accepted * 100.0 / total_getworks : 0.0; efficiency = total_getworks ? total_accepted * 100.0 / total_getworks : 0.0;
applog(LOG_WARNING, "\nSummary of runtime statistics:\n"); applog(LOG_WARNING, "\nSummary of runtime statistics:\n");
@ -4880,7 +4880,6 @@ static void print_summary(void)
mhash_base = false; mhash_base = false;
} }
if (total_secs)
applog(LOG_WARNING, "Average hashrate: %.1f %shash/s", displayed_hashes, mhash_base? "Mega" : "Kilo"); applog(LOG_WARNING, "Average hashrate: %.1f %shash/s", displayed_hashes, mhash_base? "Mega" : "Kilo");
applog(LOG_WARNING, "Solved blocks: %d", found_blocks); applog(LOG_WARNING, "Solved blocks: %d", found_blocks);
applog(LOG_WARNING, "Queued work requests: %d", total_getworks); applog(LOG_WARNING, "Queued work requests: %d", total_getworks);

Loading…
Cancel
Save