Provide a mechanism to zero all the statistics from the menu.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
diff --git a/cgminer.c b/cgminer.c
index 6e03e3f..9849820 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3911,6 +3911,50 @@ void write_config(FILE *fcfg)
json_escape_free();
}
+void zero_stats(void)
+{
+ int i;
+
+ gettimeofday(&total_tv_start, NULL);
+ total_mhashes_done = 0;
+ total_getworks = 0;
+ total_accepted = 0;
+ total_rejected = 0;
+ hw_errors = 0;
+ total_stale = 0;
+ total_discarded = 0;
+ local_work = 0;
+ total_go = 0;
+ total_ro = 0;
+ total_secs = 1.0;
+ best_diff = 0;
+ suffix_string(best_diff, best_share, 0);
+
+ for (i = 0; i < total_pools; i++) {
+ struct pool *pool = pools[i];
+
+ pool->getwork_requested = 0;
+ pool->accepted = 0;
+ pool->rejected = 0;
+ pool->stale_shares = 0;
+ pool->discarded_work = 0;
+ pool->getfail_occasions = 0;
+ pool->remotefail_occasions = 0;
+ }
+
+ mutex_lock(&hash_lock);
+ for (i = 0; i < total_devices; ++i) {
+ struct cgpu_info *cgpu = devices[i];
+
+ cgpu->total_mhashes = 0;
+ cgpu->accepted = 0;
+ cgpu->rejected = 0;
+ cgpu->hw_errors = 0;
+ cgpu->utility = 0.0;
+ }
+ mutex_unlock(&hash_lock);
+}
+
#ifdef HAVE_CURSES
static void display_pools(void)
{
@@ -4068,7 +4112,7 @@ retry:
wlogprint("[N]ormal [C]lear [S]ilent mode (disable all output)\n");
wlogprint("[D]ebug:%s\n[P]er-device:%s\n[Q]uiet:%s\n[V]erbose:%s\n"
"[R]PC debug:%s\n[W]orkTime details:%s\nco[M]pact: %s\n"
- "[L]og interval:%d\n",
+ "[L]og interval:%d\n[Z]ero statistics\n",
opt_debug ? "on" : "off",
want_per_device_stats? "on" : "off",
opt_quiet ? "on" : "off",
@@ -4139,6 +4183,9 @@ retry:
opt_worktime ^= true;
wlogprint("WorkTime details %s\n", opt_worktime ? "enabled" : "disabled");
goto retry;
+ } else if (!strncasecmp(&input, "z", 1)) {
+ zero_stats();
+ goto retry;
} else
clear_logwin();