aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2019-08-28 08:15:54 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-08-28 18:15:03 -0300
commitea4385f804eadce3f4fd8698d4ffd9e85fb6d5e0 (patch)
tree7f0a20022dff17b1acf7a49e860660550fc30142 /tools/perf/builtin-top.c
parentperf clang: Delete needless util-cxx.h header (diff)
downloadlinux-dev-ea4385f804eadce3f4fd8698d4ffd9e85fb6d5e0.tar.xz
linux-dev-ea4385f804eadce3f4fd8698d4ffd9e85fb6d5e0.zip
perf top: Decay all events in the evlist
Currently perf top only decays entries in a selected evsel. I don't know whether it's intended (maybe due to performance reason?) but anyway it might show incorrect output when event group is used since users will see leader event is decayed but others are not. This patch moves the decay code into perf_top__resort_hists() so that stdio and TUI code shared the logic. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/20190827231555.121411-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 42ba733c9045..104dbb1095c5 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -265,13 +265,23 @@ out_unlock:
pthread_mutex_unlock(&notes->lock);
}
-static void evlist__resort_hists(struct evlist *evlist)
+static void perf_top__resort_hists(struct perf_top *t)
{
+ struct evlist *evlist = t->evlist;
struct evsel *pos;
evlist__for_each_entry(evlist, pos) {
struct hists *hists = evsel__hists(pos);
+ if (evlist->enabled) {
+ if (t->zero) {
+ hists__delete_entries(hists);
+ } else {
+ hists__decay_entries(hists, t->hide_user_symbols,
+ t->hide_kernel_symbols);
+ }
+ }
+
hists__collapse_resort(hists, NULL);
/* Non-group events are considered as leader */
@@ -320,16 +330,7 @@ static void perf_top__print_sym_table(struct perf_top *top)
return;
}
- if (top->evlist->enabled) {
- if (top->zero) {
- hists__delete_entries(hists);
- } else {
- hists__decay_entries(hists, top->hide_user_symbols,
- top->hide_kernel_symbols);
- }
- }
-
- evlist__resort_hists(top->evlist);
+ perf_top__resort_hists(top);
hists__output_recalc_col_len(hists, top->print_entries - printed);
putchar('\n');
@@ -577,24 +578,11 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
- struct evsel *evsel = t->sym_evsel;
- struct hists *hists;
if (t->evlist->selected != NULL)
t->sym_evsel = t->evlist->selected;
- hists = evsel__hists(evsel);
-
- if (t->evlist->enabled) {
- if (t->zero) {
- hists__delete_entries(hists);
- } else {
- hists__decay_entries(hists, t->hide_user_symbols,
- t->hide_kernel_symbols);
- }
- }
-
- evlist__resort_hists(t->evlist);
+ perf_top__resort_hists(t);
if (t->lost || t->drop)
pr_warning("Too slow to read ring buffer (change period (-c/-F) or limit CPUs (-C)\n");