aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/stdio/hist.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-03-07 14:44:46 -0500
committerIngo Molnar <mingo@kernel.org>2016-03-08 04:11:19 -0500
commit1b2dbbf41a0f4cf7a5662bccb9a18128d16e5ffb (patch)
tree284079169d6939125553b2946ebd2318019029d8 /tools/perf/ui/stdio/hist.c
parentc3bc0c436899d01c3a09fddb308d487cc032fbd2 (diff)
perf hists: Use own hpp_list for hierarchy mode
Now each hists has its own hpp lists in hierarchy. So instead of having a pointer to a single perf_hpp_fmt in a hist entry, make it point the hpp_list for its level. This will be used to support multiple sort keys in a single hierarchy level. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1457361308-514-3-git-send-email-namhyung@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/ui/stdio/hist.c')
-rw-r--r--tools/perf/ui/stdio/hist.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 6d06fbb365b6..073642a63cc9 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -451,33 +451,33 @@ static int hist_entry__hierarchy_fprintf(struct hist_entry *he,
451 advance_hpp(hpp, ret); 451 advance_hpp(hpp, ret);
452 } 452 }
453 453
454 if (sep) 454 if (!sep)
455 ret = scnprintf(hpp->buf, hpp->size, "%s", sep);
456 else
457 ret = scnprintf(hpp->buf, hpp->size, "%*s", 455 ret = scnprintf(hpp->buf, hpp->size, "%*s",
458 (nr_sort_key - 1) * HIERARCHY_INDENT + 2, ""); 456 (nr_sort_key - 1) * HIERARCHY_INDENT, "");
459 advance_hpp(hpp, ret); 457 advance_hpp(hpp, ret);
460 458
461 printed += fprintf(fp, "%s", buf); 459 printed += fprintf(fp, "%s", buf);
462 460
463 hpp->buf = buf; 461 perf_hpp_list__for_each_format(he->hpp_list, fmt) {
464 hpp->size = size; 462 hpp->buf = buf;
465 463 hpp->size = size;
466 /* 464
467 * No need to call hist_entry__snprintf_alignment() since this 465 /*
468 * fmt is always the last column in the hierarchy mode. 466 * No need to call hist_entry__snprintf_alignment() since this
469 */ 467 * fmt is always the last column in the hierarchy mode.
470 fmt = he->fmt; 468 */
471 if (perf_hpp__use_color() && fmt->color) 469 if (perf_hpp__use_color() && fmt->color)
472 fmt->color(fmt, hpp, he); 470 fmt->color(fmt, hpp, he);
473 else 471 else
474 fmt->entry(fmt, hpp, he); 472 fmt->entry(fmt, hpp, he);
475 473
476 /* 474 /*
477 * dynamic entries are right-aligned but we want left-aligned 475 * dynamic entries are right-aligned but we want left-aligned
478 * in the hierarchy mode 476 * in the hierarchy mode
479 */ 477 */
480 printed += fprintf(fp, "%s\n", ltrim(buf)); 478 printed += fprintf(fp, "%s%s", sep ?: " ", ltrim(buf));
479 }
480 printed += putc('\n', fp);
481 481
482 if (symbol_conf.use_callchain && he->leaf) { 482 if (symbol_conf.use_callchain && he->leaf) {
483 u64 total = hists__total_period(hists); 483 u64 total = hists__total_period(hists);