diff options
| author | Taeung Song <treeze.taeung@gmail.com> | 2014-10-07 03:13:15 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-15 14:47:48 -0400 |
| commit | 1e378ebd117d1828b9d5dbe0538887478fcb9d84 (patch) | |
| tree | faecdadd211eea302fae2326d1b4e78283941efa /tools/perf/ui | |
| parent | ec4212d88a77eb6caec10777ddd629b702a5ebbd (diff) | |
perf top: Add a visual cue for toggle zeroing of samples
When 'perf top' is run, one can't easily find a difference
between -z option and normal output.
So I added a visual cue to know whether it is the zeroing or not.
Output is as below.
Before:
$ perf top
Samples: 61K of event 'cycles', Event count (approx.): 3908136933
Overhead Shared Object Symbol
1.42% firefox [.] 0x0000000000011e76
1.32% libpthread-2.17.so [.] pthread_mutex_lock
If you press key 'z' or run with zero option like '$ perf top --zero', it is as below.
After:
Samples: 61K of event 'cycles', Event count (approx.): 3908136933 [z]
Overhead Shared Object Symbol
1.42% firefox [.] 0x0000000000011e76
1.32% libpthread-2.17.so [.] pthread_mutex_lock
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1412665995-26359-1-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui')
| -rw-r--r-- | tools/perf/ui/browsers/hists.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 68eab9ea1634..cfb976b3de3a 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
| @@ -35,7 +35,9 @@ struct hist_browser { | |||
| 35 | 35 | ||
| 36 | extern void hist_browser__init_hpp(void); | 36 | extern void hist_browser__init_hpp(void); |
| 37 | 37 | ||
| 38 | static int hists__browser_title(struct hists *hists, char *bf, size_t size); | 38 | static int hists__browser_title(struct hists *hists, |
| 39 | struct hist_browser_timer *hbt, | ||
| 40 | char *bf, size_t size); | ||
| 39 | static void hist_browser__update_nr_entries(struct hist_browser *hb); | 41 | static void hist_browser__update_nr_entries(struct hist_browser *hb); |
| 40 | 42 | ||
| 41 | static struct rb_node *hists__filter_entries(struct rb_node *nd, | 43 | static struct rb_node *hists__filter_entries(struct rb_node *nd, |
| @@ -390,7 +392,7 @@ static int hist_browser__run(struct hist_browser *browser, | |||
| 390 | browser->b.entries = &browser->hists->entries; | 392 | browser->b.entries = &browser->hists->entries; |
| 391 | browser->b.nr_entries = hist_browser__nr_entries(browser); | 393 | browser->b.nr_entries = hist_browser__nr_entries(browser); |
| 392 | 394 | ||
| 393 | hists__browser_title(browser->hists, title, sizeof(title)); | 395 | hists__browser_title(browser->hists, hbt, title, sizeof(title)); |
| 394 | 396 | ||
| 395 | if (ui_browser__show(&browser->b, title, | 397 | if (ui_browser__show(&browser->b, title, |
| 396 | "Press '?' for help on key bindings") < 0) | 398 | "Press '?' for help on key bindings") < 0) |
| @@ -417,7 +419,8 @@ static int hist_browser__run(struct hist_browser *browser, | |||
| 417 | ui_browser__warn_lost_events(&browser->b); | 419 | ui_browser__warn_lost_events(&browser->b); |
| 418 | } | 420 | } |
| 419 | 421 | ||
| 420 | hists__browser_title(browser->hists, title, sizeof(title)); | 422 | hists__browser_title(browser->hists, |
| 423 | hbt, title, sizeof(title)); | ||
| 421 | ui_browser__show_title(&browser->b, title); | 424 | ui_browser__show_title(&browser->b, title); |
| 422 | continue; | 425 | continue; |
| 423 | } | 426 | } |
| @@ -1204,7 +1207,15 @@ static struct thread *hist_browser__selected_thread(struct hist_browser *browser | |||
| 1204 | return browser->he_selection->thread; | 1207 | return browser->he_selection->thread; |
| 1205 | } | 1208 | } |
| 1206 | 1209 | ||
| 1207 | static int hists__browser_title(struct hists *hists, char *bf, size_t size) | 1210 | /* Check whether the browser is for 'top' or 'report' */ |
| 1211 | static inline bool is_report_browser(void *timer) | ||
| 1212 | { | ||
| 1213 | return timer == NULL; | ||
| 1214 | } | ||
| 1215 | |||
| 1216 | static int hists__browser_title(struct hists *hists, | ||
| 1217 | struct hist_browser_timer *hbt, | ||
| 1218 | char *bf, size_t size) | ||
| 1208 | { | 1219 | { |
| 1209 | char unit; | 1220 | char unit; |
| 1210 | int printed; | 1221 | int printed; |
| @@ -1258,6 +1269,13 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size) | |||
| 1258 | if (dso) | 1269 | if (dso) |
| 1259 | printed += scnprintf(bf + printed, size - printed, | 1270 | printed += scnprintf(bf + printed, size - printed, |
| 1260 | ", DSO: %s", dso->short_name); | 1271 | ", DSO: %s", dso->short_name); |
| 1272 | if (!is_report_browser(hbt)) { | ||
| 1273 | struct perf_top *top = hbt->arg; | ||
| 1274 | |||
| 1275 | if (top->zero) | ||
| 1276 | printed += scnprintf(bf + printed, size - printed, " [z]"); | ||
| 1277 | } | ||
| 1278 | |||
| 1261 | return printed; | 1279 | return printed; |
| 1262 | } | 1280 | } |
| 1263 | 1281 | ||
| @@ -1269,12 +1287,6 @@ static inline void free_popup_options(char **options, int n) | |||
| 1269 | zfree(&options[i]); | 1287 | zfree(&options[i]); |
| 1270 | } | 1288 | } |
| 1271 | 1289 | ||
| 1272 | /* Check whether the browser is for 'top' or 'report' */ | ||
| 1273 | static inline bool is_report_browser(void *timer) | ||
| 1274 | { | ||
| 1275 | return timer == NULL; | ||
| 1276 | } | ||
| 1277 | |||
| 1278 | /* | 1290 | /* |
| 1279 | * Only runtime switching of perf data file will make "input_name" point | 1291 | * Only runtime switching of perf data file will make "input_name" point |
| 1280 | * to a malloced buffer. So add "is_input_name_malloced" flag to decide | 1292 | * to a malloced buffer. So add "is_input_name_malloced" flag to decide |
