mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
Make the log show what the thread is: cpu or gpu and what number.
This commit is contained in:
parent
1dfbe60353
commit
08a7821072
32
cpu-miner.c
32
cpu-miner.c
@ -337,7 +337,7 @@ static bool submit_upstream_work(CURL *curl, const struct work *work)
|
||||
json_t *val, *res;
|
||||
char s[345];
|
||||
bool rc = false;
|
||||
const int thr_id = work->thr_id;
|
||||
struct cgpu_info *cgpu = thr_info[work->thr_id].cgpu;
|
||||
|
||||
/* build hex string */
|
||||
hexstr = bin2hex(work->data, sizeof(work->data));
|
||||
@ -367,17 +367,18 @@ static bool submit_upstream_work(CURL *curl, const struct work *work)
|
||||
* rejected values but the chance of two submits completing at the
|
||||
* same time is zero so there is no point adding extra locking */
|
||||
if (json_is_true(res)) {
|
||||
thr_info[thr_id].accepted++;
|
||||
cgpu->accepted++;
|
||||
accepted++;
|
||||
if (opt_debug)
|
||||
applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)");
|
||||
} else {
|
||||
thr_info[thr_id].rejected++;
|
||||
cgpu->rejected++;
|
||||
rejected++;
|
||||
if (opt_debug)
|
||||
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
|
||||
}
|
||||
applog(LOG_INFO, "Thread: %d Accepted: %d Rejected: %d HW errors: %d", thr_id, thr_info[thr_id].accepted, thr_info[thr_id].rejected, thr_info[thr_id].hw_errors);
|
||||
applog(LOG_INFO, "%sPU: %d Accepted: %d Rejected: %d HW errors: %d",
|
||||
cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, cgpu->accepted, cgpu->rejected, cgpu->hw_errors);
|
||||
|
||||
json_decref(val);
|
||||
|
||||
@ -1397,9 +1398,20 @@ int main (int argc, char *argv[])
|
||||
/* start GPU mining threads */
|
||||
for (i = 0; i < gpu_threads; i++) {
|
||||
int gpu = i % nDevs;
|
||||
thr = &thr_info[i];
|
||||
|
||||
thr = &thr_info[i];
|
||||
thr->id = i;
|
||||
if (! (i % opt_g_threads)) {
|
||||
thr->cgpu = calloc(1, sizeof(struct cgpu_info));
|
||||
if (unlikely(!thr->cgpu)) {
|
||||
applog(LOG_ERR, "Failed to calloc cgpu_info");
|
||||
return 1;
|
||||
}
|
||||
thr->cgpu->is_gpu = 1;
|
||||
thr->cgpu->cpu_gpu = gpu;
|
||||
} else
|
||||
thr->cgpu = thr_info[i - (i % opt_g_threads)].cgpu;
|
||||
|
||||
thr->q = tq_new();
|
||||
if (!thr->q)
|
||||
return 1;
|
||||
@ -1426,6 +1438,16 @@ int main (int argc, char *argv[])
|
||||
thr = &thr_info[i];
|
||||
|
||||
thr->id = i;
|
||||
if (! (i % opt_g_threads)) {
|
||||
thr->cgpu = calloc(1, sizeof(struct cgpu_info));
|
||||
if (unlikely(!thr->cgpu)) {
|
||||
applog(LOG_ERR, "Failed to calloc cgpu_info");
|
||||
return 1;
|
||||
}
|
||||
thr->cgpu->cpu_gpu = cpu_from_thr_id(i);
|
||||
} else
|
||||
thr->cgpu = thr_info[cpu_from_thr_id(i - (i % opt_g_threads))].cgpu;
|
||||
|
||||
thr->q = tq_new();
|
||||
if (!thr->q)
|
||||
return 1;
|
||||
|
@ -204,7 +204,7 @@ out:
|
||||
if (opt_debug)
|
||||
applog(LOG_DEBUG, "No best_g found! Error in OpenCL code?");
|
||||
hw_errors++;
|
||||
thr->hw_errors++;
|
||||
thr->cgpu->hw_errors++;
|
||||
}
|
||||
free(pcd);
|
||||
}
|
||||
|
12
miner.h
12
miner.h
@ -110,13 +110,19 @@ enum {
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
#endif
|
||||
|
||||
struct cgpu_info {
|
||||
int is_gpu;
|
||||
int cpu_gpu;
|
||||
int accepted;
|
||||
int rejected;
|
||||
int hw_errors;
|
||||
};
|
||||
|
||||
struct thr_info {
|
||||
int id;
|
||||
pthread_t pth;
|
||||
struct thread_q *q;
|
||||
int accepted;
|
||||
int rejected;
|
||||
int hw_errors;
|
||||
struct cgpu_info *cgpu;
|
||||
};
|
||||
|
||||
static inline uint32_t swab32(uint32_t v)
|
||||
|
Loading…
Reference in New Issue
Block a user