mirror of
https://github.com/GOSTSec/sgminer
synced 2025-08-26 13:52:02 +00:00
Only update the hashmeter once per second from gpu mining threads.
This commit is contained in:
parent
063adc6434
commit
c29a4322dd
13
cpu-miner.c
13
cpu-miner.c
@ -914,9 +914,10 @@ static void *gpuminer_thread(void *userdata)
|
|||||||
|
|
||||||
struct work *work = malloc(sizeof(struct work));
|
struct work *work = malloc(sizeof(struct work));
|
||||||
bool need_work = true;
|
bool need_work = true;
|
||||||
unsigned int threads = 1 << (15 + scan_intensity);
|
unsigned const int threads = 1 << (15 + scan_intensity);
|
||||||
unsigned int vectors = clState->preferred_vwidth;
|
unsigned const int vectors = clState->preferred_vwidth;
|
||||||
unsigned int hashes_done = threads * vectors;
|
unsigned const int hashes = threads * vectors;
|
||||||
|
unsigned int hashes_done = 0;
|
||||||
|
|
||||||
gettimeofday(&tv_start, NULL);
|
gettimeofday(&tv_start, NULL);
|
||||||
globalThreads[0] = threads;
|
globalThreads[0] = threads;
|
||||||
@ -984,10 +985,14 @@ static void *gpuminer_thread(void *userdata)
|
|||||||
|
|
||||||
gettimeofday(&tv_end, NULL);
|
gettimeofday(&tv_end, NULL);
|
||||||
timeval_subtract(&diff, &tv_end, &tv_start);
|
timeval_subtract(&diff, &tv_end, &tv_start);
|
||||||
|
hashes_done += hashes;
|
||||||
|
work->blk.nonce += hashes;
|
||||||
|
if (diff.tv_sec >= 1) {
|
||||||
hashmeter(thr_id, &diff, hashes_done);
|
hashmeter(thr_id, &diff, hashes_done);
|
||||||
gettimeofday(&tv_start, NULL);
|
gettimeofday(&tv_start, NULL);
|
||||||
|
hashes_done = 0;
|
||||||
|
}
|
||||||
|
|
||||||
work->blk.nonce += hashes_done;
|
|
||||||
timeval_subtract(&diff, &tv_end, &tv_workstart);
|
timeval_subtract(&diff, &tv_end, &tv_workstart);
|
||||||
|
|
||||||
if (diff.tv_sec > opt_scantime ||
|
if (diff.tv_sec > opt_scantime ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user