mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-09 14:28:12 +00:00
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.
This commit is contained in:
parent
796c032aae
commit
011512561a
3
miner.h
3
miner.h
@ -355,6 +355,9 @@ struct device_drv {
|
|||||||
void (*thread_shutdown)(struct thr_info *);
|
void (*thread_shutdown)(struct thr_info *);
|
||||||
void (*thread_enable)(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?
|
// Does it need to be free()d?
|
||||||
bool copy;
|
bool copy;
|
||||||
|
|
||||||
|
@ -4436,6 +4436,11 @@ void zero_stats(void)
|
|||||||
cgpu->diff_rejected = 0;
|
cgpu->diff_rejected = 0;
|
||||||
cgpu->last_share_diff = 0;
|
cgpu->last_share_diff = 0;
|
||||||
mutex_unlock(&hash_lock);
|
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)
|
|||||||
#define noop_flush_work noop_reinit_device
|
#define noop_flush_work noop_reinit_device
|
||||||
#define noop_update_work noop_reinit_device
|
#define noop_update_work noop_reinit_device
|
||||||
#define noop_queue_full noop_get_stats
|
#define noop_queue_full noop_get_stats
|
||||||
|
#define noop_zero_stats noop_reinit_device
|
||||||
|
|
||||||
/* Fill missing driver drv functions with noops */
|
/* Fill missing driver drv functions with noops */
|
||||||
void fill_device_drv(struct device_drv *drv)
|
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;
|
drv->update_work = &noop_update_work;
|
||||||
if (!drv->queue_full)
|
if (!drv->queue_full)
|
||||||
drv->queue_full = &noop_queue_full;
|
drv->queue_full = &noop_queue_full;
|
||||||
|
if (!drv->zero_stats)
|
||||||
|
drv->zero_stats = &noop_zero_stats;
|
||||||
if (!drv->max_diff)
|
if (!drv->max_diff)
|
||||||
drv->max_diff = 1;
|
drv->max_diff = 1;
|
||||||
if (!drv->working_diff)
|
if (!drv->working_diff)
|
||||||
|
Loading…
Reference in New Issue
Block a user