Store when the last getwork was retrieved and display it in the API summary.
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
diff --git a/api.c b/api.c
index 2b16beb..a05468c 100644
--- a/api.c
+++ b/api.c
@@ -2462,6 +2462,7 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
double stalep = (total_diff_accepted + total_diff_rejected + total_diff_stale) ?
(double)(total_diff_stale) / (double)(total_diff_accepted + total_diff_rejected + total_diff_stale) : 0;
root = api_add_percent(root, "Pool Stale%", &stalep, false);
+ root = api_add_time(root, "Last getwork", &last_getwork, false);
mutex_unlock(&hash_lock);
diff --git a/cgminer.c b/cgminer.c
index 6238a30..b2fb715 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -112,6 +112,7 @@ int opt_expiry = 120;
static const bool opt_time = true;
unsigned long long global_hashrate;
unsigned long global_quota_gcd = 1;
+time_t last_getwork;
#if defined(USE_USBUTILS)
int nDevs;
@@ -5967,6 +5968,7 @@ struct work *get_work(struct thr_info *thr, const int thr_id)
wake_gws();
}
}
+ last_getwork = time(NULL);
applog(LOG_DEBUG, "Got work from get queue to get work for thread %d", thr_id);
work->thr_id = thr_id;
diff --git a/miner.h b/miner.h
index a4717a6..11b9553 100644
--- a/miner.h
+++ b/miner.h
@@ -946,6 +946,7 @@ extern int opt_api_port;
extern bool opt_api_listen;
extern bool opt_api_network;
extern bool opt_delaynet;
+extern time_t last_getwork;
extern bool opt_restart;
extern char *opt_icarus_options;
extern char *opt_icarus_timing;