Browse Source

multialgo: clear hashrate stats on switch

2upstream
Tanguy Pruvot 9 years ago
parent
commit
1e3db41a8d
  1. 2
      ccminer.cpp
  2. 22
      pools.cpp

2
ccminer.cpp

@ -179,7 +179,7 @@ struct work_restart *work_restart = NULL;
static int app_exit_code = EXIT_CODE_OK; static int app_exit_code = EXIT_CODE_OK;
pthread_mutex_t applog_lock; pthread_mutex_t applog_lock;
static pthread_mutex_t stats_lock; pthread_mutex_t stats_lock;
double thr_hashrates[MAX_GPUS] = { 0 }; double thr_hashrates[MAX_GPUS] = { 0 };
uint64_t global_hashrate = 0; uint64_t global_hashrate = 0;
double stratum_diff = 0.0; double stratum_diff = 0.0;

22
pools.cpp

@ -29,6 +29,7 @@ extern char* short_url;
extern struct work _ALIGN(64) g_work; extern struct work _ALIGN(64) g_work;
extern struct stratum_ctx stratum; extern struct stratum_ctx stratum;
extern pthread_mutex_t stratum_work_lock; 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 get_work(struct thr_info *thr, struct work *work);
extern bool stratum_need_reset; extern bool stratum_need_reset;
extern time_t firstwork_time; extern time_t firstwork_time;
@ -198,18 +199,29 @@ bool pool_switch(int thr_id, int pooln)
pthread_mutex_unlock(&stratum_work_lock); pthread_mutex_unlock(&stratum_work_lock);
// algo "blind" switch without free, not proper // algo "blind" switch without free, not proper
// todo: barrier required to free algo resources
if (p->algo != (int) opt_algo) { if (p->algo != (int) opt_algo) {
opt_algo = (enum sha_algos) p->algo;
for (int n=0; n<opt_n_threads; n++) if (opt_algo != ALGO_AUTO) {
thr_hashrates[n] = 0.;
// todo: a barrier is required to free algo resources
if (opt_algo != ALGO_AUTO)
algo_switch = true; algo_switch = true;
pthread_mutex_lock(&stats_lock);
for (int n=0; n<opt_n_threads; n++)
thr_hashrates[n] = 0.;
stats_purge_all();
if (check_dups)
hashlog_purge_all();
pthread_mutex_unlock(&stats_lock);
}
opt_algo = (enum sha_algos) p->algo;
} }
if (prevn != cur_pooln) { if (prevn != cur_pooln) {
pool_switch_count++; pool_switch_count++;
net_diff = 0;
g_work_time = 0; g_work_time = 0;
g_work.data[0] = 0; g_work.data[0] = 0;
pool_is_switching = true; pool_is_switching = true;

Loading…
Cancel
Save