]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - tools/perf/ui/browsers/hists.c
perf tools: Introduce zfree
[mirror_ubuntu-artful-kernel.git] / tools / perf / ui / browsers / hists.c
index a440e03cd8c235402b626526b41676b3ad95488b..022d1731b80128d594299e7e44eefb8ecf3c91e4 100644 (file)
@@ -1267,10 +1267,8 @@ static inline void free_popup_options(char **options, int n)
 {
        int i;
 
-       for (i = 0; i < n; ++i) {
-               free(options[i]);
-               options[i] = NULL;
-       }
+       for (i = 0; i < n; ++i)
+               zfree(&options[i]);
 }
 
 /* Check whether the browser is for 'top' or 'report' */
@@ -1400,6 +1398,36 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
        char script_opt[64];
        int delay_secs = hbt ? hbt->refresh : 0;
 
+#define HIST_BROWSER_HELP_COMMON                                       \
+       "h/?/F1        Show this window\n"                              \
+       "UP/DOWN/PGUP\n"                                                \
+       "PGDN/SPACE    Navigate\n"                                      \
+       "q/ESC/CTRL+C  Exit browser\n\n"                                \
+       "For multiple event sessions:\n\n"                              \
+       "TAB/UNTAB     Switch events\n\n"                               \
+       "For symbolic views (--sort has sym):\n\n"                      \
+       "->            Zoom into DSO/Threads & Annotate current symbol\n" \
+       "<-            Zoom out\n"                                      \
+       "a             Annotate current symbol\n"                       \
+       "C             Collapse all callchains\n"                       \
+       "d             Zoom into current DSO\n"                         \
+       "E             Expand all callchains\n"                         \
+
+       /* help messages are sorted by lexical order of the hotkey */
+       const char report_help[] = HIST_BROWSER_HELP_COMMON
+       "i             Show header information\n"
+       "P             Print histograms to perf.hist.N\n"
+       "r             Run available scripts\n"
+       "s             Switch to another data file in PWD\n"
+       "t             Zoom into current Thread\n"
+       "V             Verbose (DSO names in callchains, etc)\n"
+       "/             Filter symbol by name";
+       const char top_help[] = HIST_BROWSER_HELP_COMMON
+       "P             Print histograms to perf.hist.N\n"
+       "t             Zoom into current Thread\n"
+       "V             Verbose (DSO names in callchains, etc)\n"
+       "/             Filter symbol by name";
+
        if (browser == NULL)
                return -1;
 
@@ -1484,29 +1512,16 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
                        if (is_report_browser(hbt))
                                goto do_data_switch;
                        continue;
+               case 'i':
+                       /* env->arch is NULL for live-mode (i.e. perf top) */
+                       if (env->arch)
+                               tui__header_window(env);
+                       continue;
                case K_F1:
                case 'h':
                case '?':
                        ui_browser__help_window(&browser->b,
-                                       "h/?/F1        Show this window\n"
-                                       "UP/DOWN/PGUP\n"
-                                       "PGDN/SPACE    Navigate\n"
-                                       "q/ESC/CTRL+C  Exit browser\n\n"
-                                       "For multiple event sessions:\n\n"
-                                       "TAB/UNTAB Switch events\n\n"
-                                       "For symbolic views (--sort has sym):\n\n"
-                                       "->            Zoom into DSO/Threads & Annotate current symbol\n"
-                                       "<-            Zoom out\n"
-                                       "a             Annotate current symbol\n"
-                                       "C             Collapse all callchains\n"
-                                       "E             Expand all callchains\n"
-                                       "d             Zoom into current DSO\n"
-                                       "t             Zoom into current Thread\n"
-                                       "r             Run available scripts('perf report' only)\n"
-                                       "s             Switch to another data file in PWD ('perf report' only)\n"
-                                       "P             Print histograms to perf.hist.N\n"
-                                       "V             Verbose (DSO names in callchains, etc)\n"
-                                       "/             Filter symbol by name");
+                               is_report_browser(hbt) ? report_help : top_help);
                        continue;
                case K_ENTER:
                case K_RIGHT: