|
|
@@ -466,6 +466,8 @@ struct pool *add_pool(void)
|
|
|
|
|
|
/* Make sure the pool doesn't think we've been idle since time 0 */
|
|
|
pool->tv_idle.tv_sec = ~0UL;
|
|
|
+
|
|
|
+ gettimeofday(&pool->cgminer_stats.start_tv, NULL);
|
|
|
|
|
|
pool->rpc_proxy = NULL;
|
|
|
|
|
|
@@ -2015,6 +2017,24 @@ void tailsprintf(char *f, const char *fmt, ...)
|
|
|
va_end(ap);
|
|
|
}
|
|
|
|
|
|
+double stats_elapsed(struct cgminer_stats *stats)
|
|
|
+{
|
|
|
+ struct timeval now;
|
|
|
+ double elapsed;
|
|
|
+
|
|
|
+ if (stats->start_tv.tv_sec == 0)
|
|
|
+ elapsed = total_secs;
|
|
|
+ else {
|
|
|
+ gettimeofday(&now, NULL);
|
|
|
+ elapsed = tdiff(&now, &stats->start_tv);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (elapsed < 1.0)
|
|
|
+ elapsed = 1.0;
|
|
|
+
|
|
|
+ return elapsed;
|
|
|
+}
|
|
|
+
|
|
|
/* Convert a uint64_t value into a truncated string for displaying with its
|
|
|
* associated suitable for Mega, Giga etc. Buf array needs to be long enough */
|
|
|
static void suffix_string(uint64_t val, char *buf, int sigdigits)
|
|
|
@@ -4911,6 +4931,7 @@ void zero_stats(void)
|
|
|
pool->diff_rejected = 0;
|
|
|
pool->diff_stale = 0;
|
|
|
pool->last_share_diff = 0;
|
|
|
+ pool->cgminer_stats.start_tv = total_tv_start;
|
|
|
pool->cgminer_stats.getwork_calls = 0;
|
|
|
pool->cgminer_stats.getwork_wait_min.tv_sec = MIN_SEC_UNSET;
|
|
|
pool->cgminer_stats.getwork_wait_max.tv_sec = 0;
|
|
|
@@ -4959,6 +4980,7 @@ void zero_stats(void)
|
|
|
cgpu->dev_thermal_cutoff_count = 0;
|
|
|
cgpu->dev_comms_error_count = 0;
|
|
|
cgpu->dev_throttle_count = 0;
|
|
|
+ cgpu->cgminer_stats.start_tv = total_tv_start;
|
|
|
cgpu->cgminer_stats.getwork_calls = 0;
|
|
|
cgpu->cgminer_stats.getwork_wait_min.tv_sec = MIN_SEC_UNSET;
|
|
|
cgpu->cgminer_stats.getwork_wait_max.tv_sec = 0;
|
|
|
@@ -6597,6 +6619,7 @@ void *miner_thread(void *userdata)
|
|
|
|
|
|
sdiff.tv_sec = sdiff.tv_usec = 0;
|
|
|
gettimeofday(&tv_lastupdate, NULL);
|
|
|
+ cgpu->cgminer_stats.start_tv = tv_lastupdate;
|
|
|
|
|
|
while (1) {
|
|
|
mythr->work_restart = false;
|