|
|
@ -793,7 +793,7 @@ static bool get_mininginfo(CURL *curl, struct work *work) |
|
|
|
if (!val && curl_err == -1) { |
|
|
|
if (!val && curl_err == -1) { |
|
|
|
allow_mininginfo = false; |
|
|
|
allow_mininginfo = false; |
|
|
|
if (opt_debug) { |
|
|
|
if (opt_debug) { |
|
|
|
applog(LOG_DEBUG, "getinfo not supported"); |
|
|
|
applog(LOG_DEBUG, "getmininginfo not supported"); |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -805,20 +805,16 @@ static bool get_mininginfo(CURL *curl, struct work *work) |
|
|
|
json_t *key = json_object_get(res, "difficulty"); |
|
|
|
json_t *key = json_object_get(res, "difficulty"); |
|
|
|
if (key && json_is_real(key)) { |
|
|
|
if (key && json_is_real(key)) { |
|
|
|
global_diff = json_real_value(key); |
|
|
|
global_diff = json_real_value(key); |
|
|
|
json_decref(key); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
key = json_object_get(res, "networkhashps"); |
|
|
|
key = json_object_get(res, "networkhashps"); |
|
|
|
if (key && json_is_integer(key)) { |
|
|
|
if (key && json_is_integer(key)) { |
|
|
|
net_hashrate = json_integer_value(key); |
|
|
|
net_hashrate = json_integer_value(key); |
|
|
|
json_decref(key); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
key = json_object_get(res, "blocks"); |
|
|
|
key = json_object_get(res, "blocks"); |
|
|
|
if (key && json_is_integer(key)) { |
|
|
|
if (key && json_is_integer(key)) { |
|
|
|
net_blocks = json_integer_value(key); |
|
|
|
net_blocks = json_integer_value(key); |
|
|
|
json_decref(key); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
json_decref(res); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
json_decref(val); |
|
|
|
json_decref(val); |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -1168,7 +1164,7 @@ static void *miner_thread(void *userdata) |
|
|
|
struct work work; |
|
|
|
struct work work; |
|
|
|
uint64_t loopcnt = 0; |
|
|
|
uint64_t loopcnt = 0; |
|
|
|
uint32_t max_nonce; |
|
|
|
uint32_t max_nonce; |
|
|
|
uint32_t end_nonce = 0xffffffffU / opt_n_threads * (thr_id + 1) - (thr_id + 1); |
|
|
|
uint32_t end_nonce = UINT32_MAX / opt_n_threads * (thr_id + 1) - (thr_id + 1); |
|
|
|
bool work_done = false; |
|
|
|
bool work_done = false; |
|
|
|
bool extrajob = false; |
|
|
|
bool extrajob = false; |
|
|
|
char s[16]; |
|
|
|
char s[16]; |
|
|
@ -1176,16 +1172,10 @@ static void *miner_thread(void *userdata) |
|
|
|
|
|
|
|
|
|
|
|
memset(&work, 0, sizeof(work)); // prevent work from being used uninitialized
|
|
|
|
memset(&work, 0, sizeof(work)); // prevent work from being used uninitialized
|
|
|
|
|
|
|
|
|
|
|
|
/* Set worker threads to nice 19 and then preferentially to SCHED_IDLE
|
|
|
|
if (opt_priority > 0) { |
|
|
|
* and if that fails, then SCHED_BATCH. No need for this to be an |
|
|
|
int prio = 2; // default to normal
|
|
|
|
* error if it fails */ |
|
|
|
|
|
|
|
if (opt_benchmark) { |
|
|
|
|
|
|
|
setpriority(PRIO_PROCESS, 0, -1); |
|
|
|
|
|
|
|
drop_policy(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
int prio = 3; // default for ccminer is above normal
|
|
|
|
|
|
|
|
#ifndef WIN32 |
|
|
|
#ifndef WIN32 |
|
|
|
prio = -1; |
|
|
|
prio = 0; |
|
|
|
// note: different behavior on linux (-19 to 19)
|
|
|
|
// note: different behavior on linux (-19 to 19)
|
|
|
|
switch (opt_priority) { |
|
|
|
switch (opt_priority) { |
|
|
|
case 0: |
|
|
|
case 0: |
|
|
@ -2436,6 +2426,9 @@ int main(int argc, char *argv[]) |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
prio = BELOW_NORMAL_PRIORITY_CLASS; |
|
|
|
prio = BELOW_NORMAL_PRIORITY_CLASS; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
prio = NORMAL_PRIORITY_CLASS; |
|
|
|
|
|
|
|
break; |
|
|
|
case 3: |
|
|
|
case 3: |
|
|
|
prio = ABOVE_NORMAL_PRIORITY_CLASS; |
|
|
|
prio = ABOVE_NORMAL_PRIORITY_CLASS; |
|
|
|
break; |
|
|
|
break; |
|
|
|