aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/perf/util/hist.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-02-26 21:13:16 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-02-26 11:20:35 -0300
commita7b5895b91fb97f2b0dcc2e3ce47413c18d19ca5 (patch)
tree05cb54cb967a12b93cd59f6807542db44728e231 /tools/perf/util/hist.c
parentperf script: Remove duplicated code and needless script_spec__findnew() (diff)
downloadwireguard-linux-a7b5895b91fb97f2b0dcc2e3ce47413c18d19ca5.tar.xz
wireguard-linux-a7b5895b91fb97f2b0dcc2e3ce47413c18d19ca5.zip
perf hists: Add more helper functions for the hierarchy mode
The hists__overhead_width() is to calculate width occupied by the overhead (and others) columns before the sort columns. The hist_entry__has_hiearchy_children() is to check whether an entry has lower entries (children) in the hierarchy to be shown in the output. This means the children should not be filtered out and above the percent limit. These two functions will be used to show information when all children of an entry is omitted by the percent limit (or filter). 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/1456488800-28124-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r--tools/perf/util/hist.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 1c530428e087..e71691977a95 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1582,6 +1582,31 @@ struct rb_node *rb_hierarchy_prev(struct rb_node *node)
return &he->rb_node;
}
+bool hist_entry__has_hierarchy_children(struct hist_entry *he, float limit)
+{
+ struct rb_node *node;
+ struct hist_entry *child;
+ float percent;
+
+ if (he->leaf)
+ return false;
+
+ node = rb_first(&he->hroot_out);
+ child = rb_entry(node, struct hist_entry, rb_node);
+
+ while (node && child->filtered) {
+ node = rb_next(node);
+ child = rb_entry(node, struct hist_entry, rb_node);
+ }
+
+ if (node)
+ percent = hist_entry__get_percent_limit(child);
+ else
+ percent = 0;
+
+ return node && percent >= limit;
+}
+
static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h,
enum hist_filter filter)
{