Add a solution counter to the output.
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
diff --git a/cpu-miner.c b/cpu-miner.c
index a8f5ba4..89c60e3 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -131,6 +131,7 @@ pthread_mutex_t time_lock;
static pthread_mutex_t hash_lock;
static unsigned long total_hashes_done;
static struct timeval total_tv_start;
+static int solutions;
struct option_help {
@@ -412,6 +413,7 @@ static bool workio_submit_work(struct workio_cmd *wc, CURL *curl)
{
int failures = 0;
+ solutions++;
/* submit solution to bitcoin via JSON-RPC */
while (!submit_upstream_work(curl, wc->u.work)) {
if (unlikely((opt_retries >= 0) && (++failures > opt_retries))) {
@@ -497,11 +499,13 @@ static void hashmeter(int thr_id, struct timeval *diff,
pthread_mutex_unlock(&hash_lock);
total_secs = (double)total_diff.tv_sec +
((double)total_diff.tv_usec / 1000000.0);
- applog(LOG_INFO, "[Total: %.2f Mhash/sec] [thread %d: %lu hashes, %.0f khash/sec]",
- total_mhashes / total_secs, thr_id, hashes_done, khashes / secs);
+ applog(LOG_INFO, "[Total: %.2f Mhash/sec] "
+ "[thread %d: %lu hashes, %.0f khash/sec] [Solved: %d]",
+ total_mhashes / total_secs, thr_id, hashes_done,
+ khashes / secs, solutions);
} else {
- applog(LOG_INFO, "[%lu hashes, %.0f khash/sec]",
- hashes_done, khashes / secs);
+ applog(LOG_INFO, "[%lu hashes, %.0f khash/sec] [Solved: %d]",
+ hashes_done, khashes / secs, solutions);
}
}