Do not add time to dynamic opencl calculations over a getwork.
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
diff --git a/cgminer.c b/cgminer.c
index c380a5b..471ce3d 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4239,6 +4239,7 @@ void *miner_thread(void *userdata)
if (api->free_work && likely(work->pool))
api->free_work(mythr, work);
get_work(work, mythr, thr_id);
+ cgpu->new_work = true;
gettimeofday(&tv_workstart, NULL);
work->blk.nonce = 0;
diff --git a/driver-opencl.c b/driver-opencl.c
index 5ca659c..500a9ea 100644
--- a/driver-opencl.c
+++ b/driver-opencl.c
@@ -1532,10 +1532,16 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work,
clFinish(clState->commandQueue);
}
- gettimeofday(&gpu->tv_gpumid, NULL);
- if (!gpu->intervals) {
- gpu->tv_gpustart.tv_sec = gpu->tv_gpumid.tv_sec;
- gpu->tv_gpustart.tv_usec = gpu->tv_gpumid.tv_usec;
+ if (gpu->dynamic) {
+ gettimeofday(&gpu->tv_gpumid, NULL);
+ if (gpu->new_work) {
+ gpu->new_work = false;
+ gpu->intervals = 0;
+ }
+ if (!gpu->intervals) {
+ gpu->tv_gpustart.tv_sec = gpu->tv_gpumid.tv_sec;
+ gpu->tv_gpustart.tv_usec = gpu->tv_gpumid.tv_usec;
+ }
}
status = thrdata->queue_kernel_parameters(clState, &work->blk, globalThreads[0]);
diff --git a/miner.h b/miner.h
index a671992..91fe7ce 100644
--- a/miner.h
+++ b/miner.h
@@ -374,6 +374,8 @@ struct cgpu_info {
int intervals, hit;
#endif
+ bool new_work;
+
float temp;
int cutofftemp;