Reset count once all threads are started to avoid slow rate being shown initially. Update copyright notice and comments.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
diff --git a/cpu-miner.c b/cpu-miner.c
index 5cd41db..0e8dfca 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -1,5 +1,6 @@
/*
+ * Copyright 2011 Con Kolivas
* Copyright 2010 Jeff Garzik
*
* This program is free software; you can redistribute it and/or modify it
@@ -1230,7 +1231,7 @@ int main (int argc, char *argv[])
gettimeofday(&total_tv_start, NULL);
gettimeofday(&total_tv_end, NULL);
- /* start gpu mining threads */
+ /* start GPU mining threads */
for (i = 0; i < nDevs; i++) {
thr = &thr_info[i];
@@ -1253,7 +1254,7 @@ int main (int argc, char *argv[])
applog(LOG_INFO, "%d gpu miner threads started", i);
- /* start mining threads */
+ /* start CPU mining threads */
for (i = nDevs; i < nDevs + opt_n_threads; i++) {
thr = &thr_info[i];
@@ -1270,11 +1271,19 @@ int main (int argc, char *argv[])
sleep(1); /* don't pound RPC server all at once */
}
+
applog(LOG_INFO, "%d cpu miner threads started, "
"using SHA256 '%s' algorithm.",
opt_n_threads,
algo_names[opt_algo]);
+ /* Restart count as it will be wrong till all threads are started */
+ pthread_mutex_lock(&hash_lock);
+ gettimeofday(&total_tv_start, NULL);
+ gettimeofday(&total_tv_end, NULL);
+ total_hashes_done = 0;
+ pthread_mutex_unlock(&hash_lock);
+
/* main loop - simply wait for workio thread to exit */
pthread_join(thr_info[work_thr_id].pth, NULL);