Commit e69f84479b7bfc0ea6c9679dc95c94ad362f8c4d

Con Kolivas 2014-02-23T15:38:59

Provide a helper function for determining time between valid share and getwork per device.

diff --git a/cgminer.c b/cgminer.c
index 749f73c..899d1a1 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6491,6 +6491,13 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
 	cgtime(&work->tv_staged);
 }
 
+/* The time difference in seconds between when this device last got work via
+ * get_work() and generated a valid share. */
+int share_work_tdiff(struct cgpu_info *cgpu)
+{
+	return cgpu->last_device_valid_work - cgpu->last_getwork;
+}
+
 struct work *get_work(struct thr_info *thr, const int thr_id)
 {
 	struct cgpu_info *cgpu = thr->cgpu;
diff --git a/miner.h b/miner.h
index a7bb062..fac4723 100644
--- a/miner.h
+++ b/miner.h
@@ -1373,6 +1373,7 @@ extern bool submit_tested_work(struct thr_info *thr, struct work *work);
 extern bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
 extern bool submit_noffset_nonce(struct thr_info *thr, struct work *work, uint32_t nonce,
 			  int noffset);
+extern int share_work_tdiff(struct cgpu_info *cgpu);
 extern struct work *get_work(struct thr_info *thr, const int thr_id);
 extern void __add_queued(struct cgpu_info *cgpu, struct work *work);
 extern struct work *get_queued(struct cgpu_info *cgpu);