Browse Source

windows: return to normal priority, fix json decref

the jansson error seems only seen in windows debug mode
master
Tanguy Pruvot 9 years ago
parent
commit
35cc5908ee
  1. 23
      ccminer.cpp
  2. 8
      util.cpp
  3. 4
      x11/x11.cu

23
ccminer.cpp

@ -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;

8
util.cpp

@ -522,16 +522,15 @@ json_t *json_rpc_call(CURL *curl, const char *url, @@ -522,16 +522,15 @@ json_t *json_rpc_call(CURL *curl, const char *url,
if (!res_val || json_is_null(res_val) ||
(err_val && !json_is_null(err_val))) {
char *s;
char *s = NULL;
if (err_val) {
s = json_dumps(err_val, 0);
json_t *msg = json_object_get(err_val, "message");
json_t *err_code = json_object_get(err_val, "code");
if (curl_err && json_integer_value(err_code))
*curl_err = (int) json_integer_value(err_code);
json_decref(err_code);
s = json_dumps(err_val, 0);
if (json_is_string(msg)) {
free(s);
s = strdup(json_string_value(msg));
@ -546,7 +545,8 @@ json_t *json_rpc_call(CURL *curl, const char *url, @@ -546,7 +545,8 @@ json_t *json_rpc_call(CURL *curl, const char *url,
else
s = strdup("(unknown reason)");
applog(LOG_ERR, "JSON-RPC call failed: %s", s);
if (!curl_err || opt_debug)
applog(LOG_ERR, "JSON-RPC call failed: %s", s);
free(s);

4
x11/x11.cu

@ -131,8 +131,8 @@ extern "C" void x11hash(void *output, const void *input) @@ -131,8 +131,8 @@ extern "C" void x11hash(void *output, const void *input)
uint32_t* debugbuf = NULL; \
cudaMallocHost(&debugbuf, 8*sizeof(uint32_t)); \
cudaMemcpy(debugbuf, d_hash[thr_id], 8*sizeof(uint32_t), cudaMemcpyDeviceToHost); \
printf("%s %08x %08x %08x %08x...\n", algo, htobe32(debugbuf[0]), htobe32(debugbuf[1]), \
htobe32(debugbuf[2]), htobe32(debugbuf[3])); \
printf("%s %08x %08x %08x %08x...\n", algo, swab32(debugbuf[0]), swab32(debugbuf[1]), \
swab32(debugbuf[2]), swab32(debugbuf[3])); \
cudaFreeHost(debugbuf); \
} \
}

Loading…
Cancel
Save