mirror of https://gitee.com/openkylin/linux.git
perf hists browser: Cleanup hist_browser__fprintf_hierarchy_entry()
The hist_browser__fprintf_hierarchy_entry() if to dump current output into a file so it needs to be sync-ed with the corresponding function hist_browser__show_hierarchy_entry(). So use hists->nr_hpp_node to indent width and use first fmt_node to print overhead columns instead of checking whether it's a sort entry (or dynamic entry). Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1457531222-18130-6-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
a515d8ff70
commit
325a62834e
|
@ -1928,8 +1928,7 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser,
|
||||||
|
|
||||||
static int hist_browser__fprintf_hierarchy_entry(struct hist_browser *browser,
|
static int hist_browser__fprintf_hierarchy_entry(struct hist_browser *browser,
|
||||||
struct hist_entry *he,
|
struct hist_entry *he,
|
||||||
FILE *fp, int level,
|
FILE *fp, int level)
|
||||||
int nr_sort_keys)
|
|
||||||
{
|
{
|
||||||
char s[8192];
|
char s[8192];
|
||||||
int printed = 0;
|
int printed = 0;
|
||||||
|
@ -1939,23 +1938,20 @@ static int hist_browser__fprintf_hierarchy_entry(struct hist_browser *browser,
|
||||||
.size = sizeof(s),
|
.size = sizeof(s),
|
||||||
};
|
};
|
||||||
struct perf_hpp_fmt *fmt;
|
struct perf_hpp_fmt *fmt;
|
||||||
|
struct perf_hpp_list_node *fmt_node;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
int ret;
|
int ret;
|
||||||
int hierarchy_indent = nr_sort_keys * HIERARCHY_INDENT;
|
int hierarchy_indent = (he->hists->nr_hpp_node - 2) * HIERARCHY_INDENT;
|
||||||
|
|
||||||
printed = fprintf(fp, "%*s", level * HIERARCHY_INDENT, "");
|
printed = fprintf(fp, "%*s", level * HIERARCHY_INDENT, "");
|
||||||
|
|
||||||
folded_sign = hist_entry__folded(he);
|
folded_sign = hist_entry__folded(he);
|
||||||
printed += fprintf(fp, "%c", folded_sign);
|
printed += fprintf(fp, "%c", folded_sign);
|
||||||
|
|
||||||
hists__for_each_format(he->hists, fmt) {
|
/* the first hpp_list_node is for overhead columns */
|
||||||
if (perf_hpp__should_skip(fmt, he->hists))
|
fmt_node = list_first_entry(&he->hists->hpp_formats,
|
||||||
continue;
|
struct perf_hpp_list_node, list);
|
||||||
|
perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
|
||||||
if (perf_hpp__is_sort_entry(fmt) ||
|
|
||||||
perf_hpp__is_dynamic_entry(fmt))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (!first) {
|
if (!first) {
|
||||||
ret = scnprintf(hpp.buf, hpp.size, " ");
|
ret = scnprintf(hpp.buf, hpp.size, " ");
|
||||||
advance_hpp(&hpp, ret);
|
advance_hpp(&hpp, ret);
|
||||||
|
@ -1992,7 +1988,6 @@ static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp)
|
||||||
struct rb_node *nd = hists__filter_entries(rb_first(browser->b.entries),
|
struct rb_node *nd = hists__filter_entries(rb_first(browser->b.entries),
|
||||||
browser->min_pcnt);
|
browser->min_pcnt);
|
||||||
int printed = 0;
|
int printed = 0;
|
||||||
int nr_sort = browser->hists->nr_sort_keys;
|
|
||||||
|
|
||||||
while (nd) {
|
while (nd) {
|
||||||
struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
|
struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
|
||||||
|
@ -2000,8 +1995,7 @@ static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp)
|
||||||
if (symbol_conf.report_hierarchy) {
|
if (symbol_conf.report_hierarchy) {
|
||||||
printed += hist_browser__fprintf_hierarchy_entry(browser,
|
printed += hist_browser__fprintf_hierarchy_entry(browser,
|
||||||
h, fp,
|
h, fp,
|
||||||
h->depth,
|
h->depth);
|
||||||
nr_sort);
|
|
||||||
} else {
|
} else {
|
||||||
printed += hist_browser__fprintf_entry(browser, h, fp);
|
printed += hist_browser__fprintf_entry(browser, h, fp);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue