Browse Source

Improve precision of total_secs used in (at least) RPC summary Elapsed

Luke Dashjr 11 years ago
parent
commit
3237d9775d
1 changed files with 4 additions and 4 deletions
  1. 4 4
      miner.c

+ 4 - 4
miner.c

@@ -8355,6 +8355,10 @@ static void hashmeter(int thr_id, struct timeval *diff,
 	/* Totals are updated by all threads so can race without locking */
 	mutex_lock(&hash_lock);
 	cgtime(&temp_tv_end);
+	
+	timersub(&temp_tv_end, &total_tv_start, &total_diff);
+	total_secs = (double)total_diff.tv_sec + ((double)total_diff.tv_usec / 1000000.0);
+	
 	timersub(&temp_tv_end, &total_tv_end, &total_diff);
 
 	total_mhashes_done += local_mhashes;
@@ -8369,10 +8373,6 @@ static void hashmeter(int thr_id, struct timeval *diff,
 	decay_time(&total_rolling, local_mhashes_done / local_secs, local_secs);
 	global_hashrate = ((unsigned long long)lround(total_rolling)) * 1000000;
 
-	timersub(&total_tv_end, &total_tv_start, &total_diff);
-	total_secs = (double)total_diff.tv_sec +
-		((double)total_diff.tv_usec / 1000000.0);
-
 	double wtotal = (total_diff_accepted + total_diff_rejected + total_diff_stale);
 	
 	multi_format_unit_array2(