Browse Source

Merge commit 'd97e19f' into stratum

Conflicts:
	README
	miner.c
Luke Dashjr 13 years ago
parent
commit
9377d09791
2 changed files with 35 additions and 9 deletions
  1. 1 0
      README
  2. 34 9
      miner.c

+ 1 - 0
README

@@ -134,6 +134,7 @@ Options for both config file and command line:
 --balance           Change multipool strategy from failover to even share balance
 --benchmark         Run BFGMiner in benchmark mode - produces no shares
 --coinbase-sig <arg> Set coinbase signature when possible
+--compact           Use compact display without per device statistics
 --debug|-D          Enable debug output
 --debuglog          Enable debug logging
 --expiry|-E <arg>   Upper bound on how many seconds after getting work we consider a share from it stale (default: 120)

+ 34 - 9
miner.c

@@ -112,6 +112,7 @@ bool use_syslog;
 bool opt_quiet;
 bool opt_realquiet;
 bool opt_loginput;
+bool opt_compact;
 const int opt_cutofftemp = 95;
 int opt_hysteresis = 3;
 static int opt_retries = -1;
@@ -1039,6 +1040,11 @@ static struct opt_table opt_config_table[] = {
 		     set_strdup, NULL, &opt_coinbase_sig,
 		     opt_hidden),
 #endif
+#ifdef HAVE_CURSES
+	OPT_WITHOUT_ARG("--compact",
+			opt_set_bool, &opt_compact,
+			"Use compact display without per device statistics"),
+#endif
 #ifdef WANT_CPUMINE
 	OPT_WITH_ARG("--cpu-threads|-t",
 		     force_nthreads_int, opt_show_intval, &opt_n_threads,
@@ -2038,6 +2044,9 @@ static void curses_print_devstatus(int thr_id)
 	char cHr[h2bs_fmt_size[H2B_NOUNIT]], aHr[h2bs_fmt_size[H2B_NOUNIT]], uHr[h2bs_fmt_size[H2B_SHORT]];
 	int ypos;
 
+	if (opt_compact)
+		return;
+
 	/* Check this isn't out of the window size */
 	ypos = cgpu->cgminer_id;
 	ypos += devsummaryYOffset;
@@ -2112,14 +2121,13 @@ static void print_status(int thr_id)
 
 #ifdef HAVE_CURSES
 /* Check for window resize. Called with curses mutex locked */
-static inline bool change_logwinsize(void)
+static inline void change_logwinsize(void)
 {
 	int x, y, logx, logy;
-	bool ret = false;
 
 	getmaxyx(mainwin, y, x);
 	if (x < 80 || y < 25)
-		return ret;
+		return;
 
 	if (y > statusy + 2 && statusy < logstart) {
 		if (y - 2 < logstart)
@@ -2129,17 +2137,13 @@ static inline bool change_logwinsize(void)
 		logcursor = statusy + 1;
 		mvwin(logwin, logcursor, 0);
 		wresize(statuswin, statusy, x);
-		ret = true;
 	}
 
 	y -= logcursor;
 	getmaxyx(logwin, logy, logx);
 	/* Detect screen size change */
-	if (x != logx || y != logy) {
+	if (x != logx || y != logy)
 		wresize(logwin, y, x);
-		ret = true;
-	}
-	return ret;
 }
 
 static void check_winsizes(void)
@@ -2149,6 +2153,7 @@ static void check_winsizes(void)
 	if (curses_active_locked()) {
 		int y, x;
 
+		erase();
 		x = getmaxx(statuswin);
 		if (logstart > LINES - 2)
 			statusy = LINES - 2;
@@ -2164,6 +2169,18 @@ static void check_winsizes(void)
 	}
 }
 
+static void switch_compact(void)
+{
+	if (opt_compact) {
+		logstart = devcursor + 1;
+		logcursor = logstart + 1;
+	} else {
+		logstart = devcursor + total_devices + 1;
+		logcursor = logstart + 1;
+	}
+	check_winsizes();
+}
+
 /* For mandatory printing when mutex is already locked */
 void wlog(const char *f, ...)
 {
@@ -2212,6 +2229,7 @@ bool log_curses_only(int prio, const char *f, va_list ap)
 void clear_logwin(void)
 {
 	if (curses_active_locked()) {
+		erase();
 		wclear(logwin);
 		unlock_curses();
 	}
@@ -4589,7 +4607,7 @@ static void display_options(void)
 	immedok(logwin, true);
 	clear_logwin();
 retry:
-	wlogprint("[N]ormal [C]lear [S]ilent mode (disable all output)\n");
+	wlogprint("[N]ormal co[M]pact mode [C]lear [S]ilent mode (disable all output)\n");
 	wlogprint("[D]ebug:%s\n[P]er-device:%s\n[Q]uiet:%s\n[V]erbose:%s\n[R]PC debug:%s\n[W]orkTime details:%s\n[L]og interval:%d\n",
 		opt_debug_console ? "on" : "off",
 	        want_per_device_stats? "on" : "off",
@@ -4615,8 +4633,10 @@ retry:
 		opt_debug_console = false;
 		opt_quiet = false;
 		opt_protocol = false;
+		opt_compact = false;
 		want_per_device_stats = false;
 		wlogprint("Output mode reset to normal\n");
+		switch_compact();
 		goto retry;
 	} else if (!strncasecmp(&input, "d", 1)) {
 		opt_debug = true;
@@ -4626,6 +4646,11 @@ retry:
 			opt_quiet = false;
 		wlogprint("Debug mode %s\n", opt_debug_console ? "enabled" : "disabled");
 		goto retry;
+	} else if (!strncasecmp(&input, "m", 1)) {
+		opt_compact ^= true;
+		wlogprint("Compact mode %s\n", opt_compact ? "enabled" : "disabled");
+		switch_compact();
+		goto retry;
 	} else if (!strncasecmp(&input, "p", 1)) {
 		want_per_device_stats ^= true;
 		opt_log_output = want_per_device_stats;