From 1e3db41a8d21f20e1e59d321e8512033efa46927 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 2 Nov 2015 19:05:07 +0100 Subject: [PATCH] multialgo: clear hashrate stats on switch --- ccminer.cpp | 2 +- pools.cpp | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ccminer.cpp b/ccminer.cpp index 08d67bf..fc9bbd2 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -179,7 +179,7 @@ struct work_restart *work_restart = NULL; static int app_exit_code = EXIT_CODE_OK; pthread_mutex_t applog_lock; -static pthread_mutex_t stats_lock; +pthread_mutex_t stats_lock; double thr_hashrates[MAX_GPUS] = { 0 }; uint64_t global_hashrate = 0; double stratum_diff = 0.0; diff --git a/pools.cpp b/pools.cpp index 387dccd..73b2e2e 100644 --- a/pools.cpp +++ b/pools.cpp @@ -29,6 +29,7 @@ extern char* short_url; extern struct work _ALIGN(64) g_work; extern struct stratum_ctx stratum; extern pthread_mutex_t stratum_work_lock; +extern pthread_mutex_t stats_lock; extern bool get_work(struct thr_info *thr, struct work *work); extern bool stratum_need_reset; extern time_t firstwork_time; @@ -198,18 +199,29 @@ bool pool_switch(int thr_id, int pooln) pthread_mutex_unlock(&stratum_work_lock); // algo "blind" switch without free, not proper + // todo: barrier required to free algo resources if (p->algo != (int) opt_algo) { - opt_algo = (enum sha_algos) p->algo; - for (int n=0; nalgo; } if (prevn != cur_pooln) { pool_switch_count++; + net_diff = 0; g_work_time = 0; g_work.data[0] = 0; pool_is_switching = true;