Add a menu and separate out display options.
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
diff --git a/main.c b/main.c
index c453e7d..8374068 100644
--- a/main.c
+++ b/main.c
@@ -758,6 +758,7 @@ static void curses_print_status(int thr_id)
whline(statuswin, '-', 80);
wmove(statuswin, logstart - 1, 0);
whline(statuswin, '-', 80);
+ mvwprintw(statuswin, gpucursor - 1, 1, "Options: [P]ool management [D]isplay options [Q]uit");
if (thr_id >= 0 && thr_id < gpu_threads) {
int gpu = dev_from_id(thr_id);
@@ -1539,6 +1540,41 @@ retry:
opt_loginput = false;
}
+static void display_options(void)
+{
+ char input;
+
+ opt_loginput = true;
+ wprintw(logwin, "\nToggle: [D]ebug [N]ormal [S]ilent [V]erbose [R]PC debug [C]lear\n");
+ wprintw(logwin, "Select an option or any other key to return\n");
+ wrefresh(logwin);
+ input = getch();
+ if (!strncasecmp(&input, "s", 1)) {
+ opt_quiet ^= true;
+ applog(LOG_WARNING, "Silent mode %s", opt_quiet ? "enabled" : "disabled");
+ } else if (!strncasecmp(&input, "v", 1)) {
+ opt_log_output ^= true;
+ applog(LOG_WARNING, "Verbose mode %s", opt_log_output ? "enabled" : "disabled");
+ } else if (!strncasecmp(&input, "n", 1)) {
+ opt_log_output = false;
+ opt_debug = false;
+ opt_quiet = false;
+ opt_protocol = false;
+ applog(LOG_WARNING, "Output mode reset to normal");
+ } else if (!strncasecmp(&input, "d", 1)) {
+ opt_debug ^= true;
+ if (opt_debug)
+ opt_log_output = true;
+ applog(LOG_WARNING, "Debug mode %s", opt_debug ? "enabled" : "disabled");
+ } else if (!strncasecmp(&input, "r", 1)) {
+ opt_protocol ^= true;
+ applog(LOG_WARNING, "RPC protocol debugging %s", opt_protocol ? "enabled" : "disabled");
+ } else if (!strncasecmp(&input, "c", 1))
+ clear_logwin();
+ wrefresh(logwin);
+ opt_loginput = false;
+}
+
static void *input_thread(void *userdata)
{
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
@@ -1553,26 +1589,8 @@ static void *input_thread(void *userdata)
if (!strncasecmp(&input, "q", 1)) {
kill_work();
return NULL;
- } else if (!strncasecmp(&input, "s", 1)) {
- opt_quiet ^= true;
- applog(LOG_WARNING, "Silent mode %s", opt_quiet ? "enabled" : "disabled");
- } else if (!strncasecmp(&input, "v", 1)) {
- opt_log_output ^= true;
- applog(LOG_WARNING, "Verbose mode %s", opt_log_output ? "enabled" : "disabled");
- } else if (!strncasecmp(&input, "n", 1)) {
- opt_log_output = true;
- opt_debug = false;
- opt_quiet = false;
- opt_protocol = false;
- applog(LOG_WARNING, "Output mode reset to normal");
- } else if (!strncasecmp(&input, "d", 1)) {
- opt_debug ^= true;
- applog(LOG_WARNING, "Debug mode %s", opt_debug ? "enabled" : "disabled");
- } else if (!strncasecmp(&input, "r", 1)) {
- opt_protocol ^= true;
- applog(LOG_WARNING, "RPC protocl debugging %s", opt_protocol ? "enabled" : "disabled");
- } else if (!strncasecmp(&input, "c", 1))
- clear_logwin();
+ } else if (!strncasecmp(&input, "d", 1))
+ display_options();
else if (!strncasecmp(&input, "p", 1))
display_pools();
}
@@ -3005,7 +3023,7 @@ int main (int argc, char *argv[])
opt_n_threads = num_processors;
}
- logcursor = 7;
+ logcursor = 8;
gpucursor = logcursor;
cpucursor = gpucursor + nDevs;
logstart = cpucursor + (opt_n_threads ? num_processors : 0) + 1;