Add a compact display mode that does not list per device statistics in the status window.
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
diff --git a/README b/README
index c213e67..4e5ea95 100644
--- a/README
+++ b/README
@@ -143,6 +143,7 @@ Options for both config file and command line:
--auto-gpu Automatically adjust all GPU engine clock speeds to maintain a target temperature
--balance Change multipool strategy from failover to even share balance
--benchmark Run cgminer in benchmark mode - produces no shares
+--compact Use compact display without per device statistics
--debug|-D Enable debug output
--expiry|-E <arg> Upper bound on how many seconds after getting work we consider a share from it stale (default: 120)
--failover-only Don't leak work to backup pools when primary pool is lagging
diff --git a/cgminer.c b/cgminer.c
index 965dde6..29d20e9 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -92,6 +92,7 @@ bool use_syslog;
bool opt_quiet;
bool opt_realquiet;
bool opt_loginput;
+bool opt_compact;
const int opt_cutofftemp = 95;
int opt_log_interval = 5;
int opt_queue = 1;
@@ -854,6 +855,13 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--bench-algo|-b",
set_int_0_to_9999, opt_show_intval, &opt_bench_algo,
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,
"Number of miner CPU threads"),
@@ -1612,7 +1620,7 @@ static void curses_print_devstatus(int thr_id)
char displayed_hashes[16], displayed_rolling[16];
uint64_t dh64, dr64;
- if (devcursor + cgpu->cgminer_id > LINES - 2)
+ if (devcursor + cgpu->cgminer_id > LINES - 2 || opt_compact)
return;
cgpu->utility = cgpu->accepted / total_secs * 60;
@@ -1672,14 +1680,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)
@@ -1689,17 +1696,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)
@@ -1709,6 +1712,7 @@ static void check_winsizes(void)
if (curses_active_locked()) {
int y, x;
+ erase();
x = getmaxx(statuswin);
if (logstart > LINES - 2)
statusy = LINES - 2;
@@ -1724,6 +1728,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, ...)
{
@@ -1772,6 +1788,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();
}
@@ -3803,7 +3820,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 ? "on" : "off",
want_per_device_stats? "on" : "off",
@@ -3829,8 +3846,10 @@ retry:
opt_debug = 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;
@@ -3839,6 +3858,11 @@ retry:
opt_quiet = false;
wlogprint("Debug mode %s\n", opt_debug ? "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;