Commit ce750e42b3a08e4505b4b7f1dcd5c65ea0132024

Con Kolivas 2011-06-12T01:35:08

Add a solution counter to the output.

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);
 	}
 }