mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-30 00:14:26 +00:00
Simplify all those total_secs usages by initialising it to 1 second.
This commit is contained in:
parent
5fadfdb219
commit
afcfea15a7
15
cgminer.c
15
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,8 +4880,7 @@ 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);
|
||||||
applog(LOG_WARNING, "Share submissions: %d", total_accepted + total_rejected);
|
applog(LOG_WARNING, "Share submissions: %d", total_accepted + total_rejected);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user