aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-02-03 09:11:23 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-02-03 10:24:22 -0500
commitb62e8dfcda8cb133c062c0e1207afea2476eb7fd (patch)
treecf8a579d8f97b009d14df7b398af6f8c86a48cc8 /tools/perf/ui
parent1ba2fc6de4ac1a87e3ece65651795760ea5cf658 (diff)
perf hists browser: Add 'L' hotkey to change percent limit
Add 'L' key action to change the percent limit applied to both of hist entries and callchains. Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1454508683-5735-4-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r--tools/perf/ui/browsers/hists.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 3a1e0965a8fd..a5a5390476ac 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2029,6 +2029,42 @@ static void hist_browser__update_nr_entries(struct hist_browser *hb)
2029 hb->nr_non_filtered_entries = nr_entries; 2029 hb->nr_non_filtered_entries = nr_entries;
2030} 2030}
2031 2031
2032static void hist_browser__update_percent_limit(struct hist_browser *hb,
2033 double percent)
2034{
2035 struct hist_entry *he;
2036 struct rb_node *nd = rb_first(&hb->hists->entries);
2037 u64 total = hists__total_period(hb->hists);
2038 u64 min_callchain_hits = total * (percent / 100);
2039
2040 hb->min_pcnt = callchain_param.min_percent = percent;
2041
2042 if (!symbol_conf.use_callchain)
2043 return;
2044
2045 while ((nd = hists__filter_entries(nd, hb->min_pcnt)) != NULL) {
2046 he = rb_entry(nd, struct hist_entry, rb_node);
2047
2048 if (callchain_param.mode == CHAIN_GRAPH_REL) {
2049 total = he->stat.period;
2050
2051 if (symbol_conf.cumulate_callchain)
2052 total = he->stat_acc->period;
2053
2054 min_callchain_hits = total * (percent / 100);
2055 }
2056
2057 callchain_param.sort(&he->sorted_chain, he->callchain,
2058 min_callchain_hits, &callchain_param);
2059
2060 /* force to re-evaluate folding state of callchains */
2061 he->init_have_children = false;
2062 hist_entry__set_folding(he, false);
2063
2064 nd = rb_next(nd);
2065 }
2066}
2067
2032static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, 2068static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
2033 const char *helpline, 2069 const char *helpline,
2034 bool left_exits, 2070 bool left_exits,
@@ -2064,6 +2100,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
2064 "E Expand all callchains\n" \ 2100 "E Expand all callchains\n" \
2065 "F Toggle percentage of filtered entries\n" \ 2101 "F Toggle percentage of filtered entries\n" \
2066 "H Display column headers\n" \ 2102 "H Display column headers\n" \
2103 "L Change percent limit\n" \
2067 "m Display context menu\n" \ 2104 "m Display context menu\n" \
2068 "S Zoom into current Processor Socket\n" \ 2105 "S Zoom into current Processor Socket\n" \
2069 2106
@@ -2219,6 +2256,24 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
2219 top->zero = !top->zero; 2256 top->zero = !top->zero;
2220 } 2257 }
2221 continue; 2258 continue;
2259 case 'L':
2260 if (ui_browser__input_window("Percent Limit",
2261 "Please enter the value you want to hide entries under that percent.",
2262 buf, "ENTER: OK, ESC: Cancel",
2263 delay_secs * 2) == K_ENTER) {
2264 char *end;
2265 double new_percent = strtod(buf, &end);
2266
2267 if (new_percent < 0 || new_percent > 100) {
2268 ui_browser__warning(&browser->b, delay_secs * 2,
2269 "Invalid percent: %.2f", new_percent);
2270 continue;
2271 }
2272
2273 hist_browser__update_percent_limit(browser, new_percent);
2274 hist_browser__reset(browser);
2275 }
2276 continue;
2222 case K_F1: 2277 case K_F1:
2223 case 'h': 2278 case 'h':
2224 case '?': 2279 case '?':