some changes related to wait stats

This commit is contained in:
Tanguy Pruvot 2015-06-05 20:26:38 +02:00
parent 2ea4635ef7
commit 555504bd98
2 changed files with 17 additions and 10 deletions

View File

@ -1470,7 +1470,7 @@ static bool wanna_mine(int thr_id)
int next = pool_get_first_valid(cur_pooln+1);
if (num_pools > 1 && pools[next].max_diff != pools[cur_pooln].max_diff)
conditional_pool_rotate = allow_pool_rotate;
if (!conditional_state[thr_id] && !opt_quiet && !thr_id)
if (!thr_id && !conditional_state[thr_id] && !opt_quiet)
applog(LOG_INFO, "network diff too high, waiting...");
state = false;
}
@ -1478,7 +1478,7 @@ static bool wanna_mine(int thr_id)
int next = pool_get_first_valid(cur_pooln+1);
if (pools[next].max_rate != pools[cur_pooln].max_rate)
conditional_pool_rotate = allow_pool_rotate;
if (!conditional_state[thr_id] && !opt_quiet && !thr_id) {
if (!thr_id && !conditional_state[thr_id] && !opt_quiet) {
char rate[32];
format_hashrate(opt_max_rate, rate);
applog(LOG_INFO, "network hashrate too high, waiting %s...", rate);
@ -1645,8 +1645,9 @@ static void *miner_thread(void *userdata)
pthread_mutex_unlock(&g_work_lock);
/* prevent gpu scans before a job is received */
if (have_stratum && work.data[0] == 0) {
sleep(1); pools[cur_pooln].wait_time += 1;
if (have_stratum && work.data[0] == 0 && !opt_benchmark) {
sleep(1);
if (!thr_id) pools[cur_pooln].wait_time += 1;
continue;
}
@ -1659,15 +1660,16 @@ static void *miner_thread(void *userdata)
pool_switch_next();
else if (time(NULL) - firstwork_time > 35) {
if (!opt_quiet)
applog(LOG_WARNING, "Pool switching timed out (1)...");
pools[cur_pooln].wait_time += 1;
applog(LOG_WARNING, "Pool switching timed out...");
if (!thr_id) pools[cur_pooln].wait_time += 1;
pool_is_switching = false;
}
sleep(1);
continue;
}
sleep(5); pools[cur_pooln].wait_time += 5;
sleep(5);
if (!thr_id) pools[cur_pooln].wait_time += 5;
continue;
}
@ -1684,6 +1686,10 @@ static void *miner_thread(void *userdata)
int passed = (int)(time(NULL) - firstwork_time);
int remain = (int)(opt_time_limit - passed);
if (remain < 0) {
if (thr_id != 0) {
sleep(1);
continue;
}
if (num_pools > 1 && pools[cur_pooln].time_limit > 0) {
if (!pool_is_switching) {
if (!opt_quiet)
@ -1692,7 +1698,7 @@ static void *miner_thread(void *userdata)
} else if (passed > 35) {
// ensure we dont stay locked if pool_is_switching is not reset...
applog(LOG_WARNING, "Pool switch to %d timed out...", cur_pooln);
pools[cur_pooln].wait_time += 1;
if (!thr_id) pools[cur_pooln].wait_time += 1;
pool_is_switching = false;
}
sleep(1);
@ -1703,7 +1709,7 @@ static void *miner_thread(void *userdata)
if (opt_benchmark) {
char rate[32];
format_hashrate((double)global_hashrate, rate);
applog(LOG_NOTICE, "Benchmark: %s", rate);
applog(LOG_NOTICE, "Benchmark: %s", rate);
usleep(200*1000);
fprintf(stderr, "%llu\n", (long long unsigned int) global_hashrate);
} else {

View File

@ -441,7 +441,8 @@ extern "C" int scanhash_skeincoin(int thr_id, uint32_t *pdata, const uint32_t *p
}
}
if ((uint64_t) pdata[19] + throughput > max_nonce) {
if ((uint64_t) throughput + pdata[19] > max_nonce) {
//applog(LOG_DEBUG, "done... max=%u", max_nonce);
*hashes_done = pdata[19] - first_nonce;
pdata[19] = max_nonce;
break;