Browse Source

Store when the last getwork was retrieved and display it in the API summary.

Conflicts:
	api.c
	cgminer.c
Con Kolivas 12 years ago
parent
commit
ad812481f5
3 changed files with 4 additions and 0 deletions
  1. 1 0
      api.c
  2. 2 0
      miner.c
  3. 1 0
      miner.h

+ 1 - 0
api.c

@@ -2106,6 +2106,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 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;
 			(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_percent(root, "Pool Stale%", &stalep, false);
+	root = api_add_time(root, "Last getwork", &last_getwork, false);
 
 
 	mutex_unlock(&hash_lock);
 	mutex_unlock(&hash_lock);
 
 

+ 2 - 0
miner.c

@@ -157,6 +157,7 @@ int opt_bench_algo = -1;
 unsigned long long global_hashrate;
 unsigned long long global_hashrate;
 static bool opt_unittest = false;
 static bool opt_unittest = false;
 unsigned long global_quota_gcd = 1;
 unsigned long global_quota_gcd = 1;
+time_t last_getwork;
 
 
 #ifdef HAVE_OPENCL
 #ifdef HAVE_OPENCL
 int opt_dynamic_interval = 7;
 int opt_dynamic_interval = 7;
@@ -8849,6 +8850,7 @@ struct work *get_work(struct thr_info *thr)
 			wake_gws();
 			wake_gws();
 		}
 		}
 	}
 	}
+	last_getwork = time(NULL);
 	applog(LOG_DEBUG, "%"PRIpreprv": Got work %d from get queue to get work for thread %d",
 	applog(LOG_DEBUG, "%"PRIpreprv": Got work %d from get queue to get work for thread %d",
 	       cgpu->proc_repr, work->id, thr_id);
 	       cgpu->proc_repr, work->id, thr_id);
 
 

+ 1 - 0
miner.h

@@ -960,6 +960,7 @@ extern int opt_api_port;
 extern bool opt_api_listen;
 extern bool opt_api_listen;
 extern bool opt_api_network;
 extern bool opt_api_network;
 extern bool opt_delaynet;
 extern bool opt_delaynet;
+extern time_t last_getwork;
 extern bool opt_restart;
 extern bool opt_restart;
 extern char *opt_icarus_options;
 extern char *opt_icarus_options;
 extern char *opt_icarus_timing;
 extern char *opt_icarus_timing;