diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-08-07 11:28:29 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-08-23 14:37:33 -0400 |
commit | f3705b062eafc2867eb0e9ee3502bd59564f103c (patch) | |
tree | a01f6125eb9334590d8990fb8105daa250264495 | |
parent | 69705b35859195b5640861fff91cc936d1baf4eb (diff) |
perf tools stdio: Display multiple header lines
Display multiple header lines in stdio output , if it's configured
within struct perf_hpp_list::nr_header_lines.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1470583710-1649-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/ui/stdio/hist.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 91b8e10cabd5..9b807cbb56b1 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -639,13 +639,10 @@ hists__fprintf_hierarchy_headers(struct hists *hists, | |||
639 | return print_hierarchy_header(hists, hpp, symbol_conf.field_sep, fp); | 639 | return print_hierarchy_header(hists, hpp, symbol_conf.field_sep, fp); |
640 | } | 640 | } |
641 | 641 | ||
642 | static int | 642 | static void fprintf_line(struct hists *hists, struct perf_hpp *hpp, |
643 | hists__fprintf_standard_headers(struct hists *hists, | 643 | int line, FILE *fp) |
644 | struct perf_hpp *hpp, | ||
645 | FILE *fp) | ||
646 | { | 644 | { |
647 | struct perf_hpp_fmt *fmt; | 645 | struct perf_hpp_fmt *fmt; |
648 | unsigned int width; | ||
649 | const char *sep = symbol_conf.field_sep; | 646 | const char *sep = symbol_conf.field_sep; |
650 | bool first = true; | 647 | bool first = true; |
651 | 648 | ||
@@ -658,14 +655,33 @@ hists__fprintf_standard_headers(struct hists *hists, | |||
658 | else | 655 | else |
659 | first = false; | 656 | first = false; |
660 | 657 | ||
661 | fmt->header(fmt, hpp, hists, 0); | 658 | fmt->header(fmt, hpp, hists, line); |
662 | fprintf(fp, "%s", hpp->buf); | 659 | fprintf(fp, "%s", hpp->buf); |
663 | } | 660 | } |
661 | } | ||
664 | 662 | ||
665 | fprintf(fp, "\n"); | 663 | static int |
664 | hists__fprintf_standard_headers(struct hists *hists, | ||
665 | struct perf_hpp *hpp, | ||
666 | FILE *fp) | ||
667 | { | ||
668 | struct perf_hpp_list *hpp_list = hists->hpp_list; | ||
669 | struct perf_hpp_fmt *fmt; | ||
670 | unsigned int width; | ||
671 | const char *sep = symbol_conf.field_sep; | ||
672 | bool first = true; | ||
673 | int line; | ||
674 | |||
675 | for (line = 0; line < hpp_list->nr_header_lines; line++) { | ||
676 | /* first # is displayed one level up */ | ||
677 | if (line) | ||
678 | fprintf(fp, "# "); | ||
679 | fprintf_line(hists, hpp, line, fp); | ||
680 | fprintf(fp, "\n"); | ||
681 | } | ||
666 | 682 | ||
667 | if (sep) | 683 | if (sep) |
668 | return 1; | 684 | return hpp_list->nr_header_lines; |
669 | 685 | ||
670 | first = true; | 686 | first = true; |
671 | 687 | ||
@@ -689,7 +705,7 @@ hists__fprintf_standard_headers(struct hists *hists, | |||
689 | 705 | ||
690 | fprintf(fp, "\n"); | 706 | fprintf(fp, "\n"); |
691 | fprintf(fp, "#\n"); | 707 | fprintf(fp, "#\n"); |
692 | return 3; | 708 | return hpp_list->nr_header_lines + 2; |
693 | } | 709 | } |
694 | 710 | ||
695 | static int hists__fprintf_headers(struct hists *hists, FILE *fp) | 711 | static int hists__fprintf_headers(struct hists *hists, FILE *fp) |