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>
This commit is contained in:
Namhyung Kim
2016-02-26 21:13:16 +09:00
committed by Arnaldo Carvalho de Melo
parent 8560bae02a
commit a7b5895b91
3 changed files with 50 additions and 0 deletions

View File

@@ -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)
{