diff --git a/cpu-miner.c b/cpu-miner.c index 391f1a89f..85f3432e7 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -159,6 +159,8 @@ int longpoll_thr_id = -1; int stratum_thr_id = -1; struct work_restart *work_restart = NULL; static struct stratum_ctx stratum; +unsigned long snd,rcv,msecs; +struct timeval tr,ts; pthread_mutex_t applog_lock; static pthread_mutex_t stats_lock; @@ -685,7 +687,10 @@ static void share_result(int result, const char *reason) char s[345]; double hashrate; int i; - + + gettimeofday(&tr, NULL); // get current time + rcv = tr.tv_sec*1000 + tr.tv_usec/1000; // calculate milliseconds + msecs=rcv-snd; hashrate = 0.; pthread_mutex_lock(&stats_lock); for (i = 0; i < opt_n_threads; i++) @@ -694,8 +699,8 @@ static void share_result(int result, const char *reason) pthread_mutex_unlock(&stats_lock); sprintf(s, hashrate >= 1e3 ? "%.0f" : "%.1f", hashrate); - applog(LOG_INFO, "accepted: %lu/%lu (%.2f%%), %s hash/s %s", - accepted_count, + applog(LOG_INFO, "accepted %lums: %lu/%lu (%.2f%%), %s hash/s %s", + msecs,accepted_count, accepted_count + rejected_count, 100. * accepted_count / (accepted_count + rejected_count), s, @@ -719,6 +724,9 @@ static bool submit_upstream_work(CURL *curl, struct work *work) applog(LOG_DEBUG, "DEBUG: stale work detected, discarding"); return true; } + + gettimeofday(&ts, NULL); // get current time + snd = ts.tv_sec*1000 + ts.tv_usec/1000; // calculate milliseconds if (have_stratum) { unsigned char ntime[4], nonce[4];