Per device last getwork won't work if the device stops asking for work.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
diff --git a/cgminer.c b/cgminer.c
index 148e242..3ea68c0 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6495,14 +6495,13 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
* get_work() and generated a valid share. */
int share_work_tdiff(struct cgpu_info *cgpu)
{
- return cgpu->last_getwork - cgpu->last_device_valid_work;
+ return last_getwork - cgpu->last_device_valid_work;
}
struct work *get_work(struct thr_info *thr, const int thr_id)
{
- struct cgpu_info *cgpu = thr->cgpu;
struct work *work = NULL;
- time_t now_t, diff_t;
+ time_t diff_t;
thread_reportout(thr);
applog(LOG_DEBUG, "Popping work from get queue to get work");
@@ -6515,22 +6514,20 @@ struct work *get_work(struct thr_info *thr, const int thr_id)
wake_gws();
}
}
- now_t = time(NULL);
- diff_t = now_t - diff_t;
+ diff_t = time(NULL) - diff_t;
/* Since this is a blocking function, we need to add grace time to
* the device's last valid work to not make outages appear to be
* device failures. */
if (diff_t > 0) {
applog(LOG_DEBUG, "Get work blocked for %d seconds", (int)diff_t);
- cgpu->last_device_valid_work += diff_t;
+ thr->cgpu->last_device_valid_work += diff_t;
}
- cgpu->last_getwork = now_t;
applog(LOG_DEBUG, "Got work from get queue to get work for thread %d", thr_id);
work->thr_id = thr_id;
thread_reportin(thr);
work->mined = true;
- work->device_diff = MIN(cgpu->drv->max_diff, work->work_difficulty);
+ work->device_diff = MIN(thr->cgpu->drv->max_diff, work->work_difficulty);
return work;
}
diff --git a/miner.h b/miner.h
index fac4723..0f70491 100644
--- a/miner.h
+++ b/miner.h
@@ -484,7 +484,6 @@ struct cgpu_info {
int last_share_pool;
time_t last_share_pool_time;
double last_share_diff;
- time_t last_getwork;
time_t last_device_valid_work;
time_t device_last_well;