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