]> sourceware.org Git - systemtap.git/commitdiff
monitor mode: add 'q' keystroke to quit
authorFrank Ch. Eigler <fche@redhat.com>
Sun, 20 Mar 2016 23:18:49 +0000 (19:18 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Sun, 20 Mar 2016 23:18:49 +0000 (19:18 -0400)
It'll be nice to have a sequence other than ^C to cause an exit, so
that e.g. we can review output / diagnostics after the script quit.
Switching to 'h' to flip between help screen and normal mode, to avoid
accidental 'q'.

elaborate.cxx
staprun/monitor.c

index 6492c52c5c84ef00fe28744691d9b9b13ca9cca2..6e596165df0e9b7ab762a91f93e6eda425cbe5ee 100644 (file)
@@ -2176,6 +2176,8 @@ static void monitor_mode_write(systemtap_session& s)
     {
       code << "  __monitor_" << it-s.probes.begin() << "_enabled" << " = 0" << endl;
     }
+  code << "} else if ($value == \"quit\") {" << endl;
+  code << "  exit()" << endl;
   code << "}";
 
   for (vector<derived_probe*>::const_iterator it = s.probes.begin();
index e9d94d6d7316c56eb60a98875eb90ea60690c28f..e7d781a27d85efada67b9f167fe00f193673b957 100644 (file)
@@ -265,13 +265,13 @@ void monitor_render(void)
       wprintw(monitor_status, "c - Reset all global variables to initial state, zeroes if unset.\n");
       wprintw(monitor_status, "s - Rotate sort columns for probes.\n");
       wprintw(monitor_status, "t - Open a prompt to enter the index of a probe to toggle.\n");
-      wprintw(monitor_status, "r - Resume script by toggling on all probes.\n");
-      wprintw(monitor_status, "p - Pause script by toggling off all probes.\n");
+      wprintw(monitor_status, "p/r Pause/Resume script by toggling off/on all probes.\n");
+      wprintw(monitor_status, "q - Quit script.\n");
       wprintw(monitor_status, "j/DownArrow - Scroll down the probe list.\n");
       wprintw(monitor_status, "k/UpArrow - Scroll up the probe list.\n");
       wprintw(monitor_status, "d/PageDown - Scroll down the output by one page.\n");
       wprintw(monitor_status, "u/PageUp - Scroll up the probe list by one page.\n");
-      mvwprintw(monitor_status, max_rows-1, 0, "press q to go back\n");
+      mvwprintw(monitor_status, max_rows-1, 0, "press h to go back\n");
       wrefresh(monitor_status);
     }
   else
@@ -472,6 +472,9 @@ void monitor_input(void)
             case 'p':
               write_command("pause", 5);
               break;
+            case 'q':
+              write_command("quit", 4);
+              break;
             case 't':
               monitor_state = insert;
               break;
@@ -506,7 +509,7 @@ void monitor_input(void)
         break;
       case help:
         ch = getch();
-        if(ch == 'q')
+        if(ch == 'h')
           monitor_state = normal;
         break;
     }
This page took 0.07314 seconds and 5 git commands to generate.