Browse Source

Add a call to a driver specific zero stats function when zero stats is called to allow each driver to reset its own stats as well if desired.

port-ckolivas
Con Kolivas 11 years ago committed by Noel Maersk
parent
commit
011512561a
  1. 3
      miner.h
  2. 8
      sgminer.c

3
miner.h

@ -355,6 +355,9 @@ struct device_drv { @@ -355,6 +355,9 @@ struct device_drv {
void (*thread_shutdown)(struct thr_info *);
void (*thread_enable)(struct thr_info *);
/* What should be zeroed in this device when global zero stats is sent */
void (*zero_stats)(struct cgpu_info *);
// Does it need to be free()d?
bool copy;

8
sgminer.c

@ -4436,6 +4436,11 @@ void zero_stats(void) @@ -4436,6 +4436,11 @@ void zero_stats(void)
cgpu->diff_rejected = 0;
cgpu->last_share_diff = 0;
mutex_unlock(&hash_lock);
/* Don't take any locks in the driver zero stats function, as
* it's called async from everything else and we don't want to
* deadlock. */
cgpu->drv->zero_stats(cgpu);
}
}
@ -7512,6 +7517,7 @@ static void noop_detect(bool __maybe_unused hotplug) @@ -7512,6 +7517,7 @@ static void noop_detect(bool __maybe_unused hotplug)
#define noop_flush_work noop_reinit_device
#define noop_update_work noop_reinit_device
#define noop_queue_full noop_get_stats
#define noop_zero_stats noop_reinit_device
/* Fill missing driver drv functions with noops */
void fill_device_drv(struct device_drv *drv)
@ -7548,6 +7554,8 @@ void fill_device_drv(struct device_drv *drv) @@ -7548,6 +7554,8 @@ void fill_device_drv(struct device_drv *drv)
drv->update_work = &noop_update_work;
if (!drv->queue_full)
drv->queue_full = &noop_queue_full;
if (!drv->zero_stats)
drv->zero_stats = &noop_zero_stats;
if (!drv->max_diff)
drv->max_diff = 1;
if (!drv->working_diff)

Loading…
Cancel
Save