Browse Source

Add --quiet option, to disable hashmeter output.

nfactor-troky
Jeff Garzik 14 years ago committed by Jeff Garzik
parent
commit
872211caad
  1. 15
      cpu-miner.c

15
cpu-miner.c

@ -60,6 +60,7 @@ static const char *algo_names[] = {
bool opt_debug = false; bool opt_debug = false;
bool opt_protocol = false; bool opt_protocol = false;
bool opt_quiet = false;
static int opt_retries = 10; static int opt_retries = 10;
static bool program_running = true; static bool program_running = true;
static const bool opt_time = true; static const bool opt_time = true;
@ -93,6 +94,9 @@ static struct option_help options_help[] = {
#endif #endif
}, },
{ "quiet",
"(-q) Disable per-thread hashmeter output (default: off)" },
{ "debug", { "debug",
"(-D) Enable debug output (default: off)" }, "(-D) Enable debug output (default: off)" },
@ -118,6 +122,7 @@ static struct option_help options_help[] = {
static struct option options[] = { static struct option options[] = {
{ "help", 0, NULL, 'h' }, { "help", 0, NULL, 'h' },
{ "algo", 1, NULL, 'a' }, { "algo", 1, NULL, 'a' },
{ "quiet", 0, NULL, 'q' },
{ "debug", 0, NULL, 'D' }, { "debug", 0, NULL, 'D' },
{ "protocol-dump", 0, NULL, 'P' }, { "protocol-dump", 0, NULL, 'P' },
{ "threads", 1, NULL, 't' }, { "threads", 1, NULL, 't' },
@ -241,9 +246,10 @@ static void hashmeter(int thr_id, struct timeval *tv_start,
khashes = hashes_done / 1000.0; khashes = hashes_done / 1000.0;
secs = (double)diff.tv_sec + ((double)diff.tv_usec / 1000000.0); secs = (double)diff.tv_sec + ((double)diff.tv_usec / 1000000.0);
printf("HashMeter(%d): %lu hashes, %.2f khash/sec\n", if (!opt_quiet)
thr_id, hashes_done, printf("HashMeter(%d): %lu hashes, %.2f khash/sec\n",
khashes / secs); thr_id, hashes_done,
khashes / secs);
} }
static void *miner_thread(void *thr_id_int) static void *miner_thread(void *thr_id_int)
@ -383,6 +389,9 @@ static void parse_arg (int key, char *arg)
if (i == ARRAY_SIZE(algo_names)) if (i == ARRAY_SIZE(algo_names))
show_usage(); show_usage();
break; break;
case 'q':
opt_quiet = true;
break;
case 'D': case 'D':
opt_debug = true; opt_debug = true;
break; break;

Loading…
Cancel
Save