[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1471986216-18390-17-git-send-email-acme@kernel.org>
Date: Tue, 23 Aug 2016 18:03:17 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...nel.org>,
David Ahern <dsahern@...il.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [PATCH 16/35] perf tools stdio: Display multiple header lines
From: Jiri Olsa <jolsa@...nel.org>
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@...nel.org>
Cc: David Ahern <dsahern@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Link: http://lkml.kernel.org/r/1470583710-1649-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/ui/stdio/hist.c | 34 +++++++++++++++++++++++++---------
1 file 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,
return print_hierarchy_header(hists, hpp, symbol_conf.field_sep, fp);
}
-static int
-hists__fprintf_standard_headers(struct hists *hists,
- struct perf_hpp *hpp,
- FILE *fp)
+static void fprintf_line(struct hists *hists, struct perf_hpp *hpp,
+ int line, FILE *fp)
{
struct perf_hpp_fmt *fmt;
- unsigned int width;
const char *sep = symbol_conf.field_sep;
bool first = true;
@@ -658,14 +655,33 @@ hists__fprintf_standard_headers(struct hists *hists,
else
first = false;
- fmt->header(fmt, hpp, hists, 0);
+ fmt->header(fmt, hpp, hists, line);
fprintf(fp, "%s", hpp->buf);
}
+}
- fprintf(fp, "\n");
+static int
+hists__fprintf_standard_headers(struct hists *hists,
+ struct perf_hpp *hpp,
+ FILE *fp)
+{
+ struct perf_hpp_list *hpp_list = hists->hpp_list;
+ struct perf_hpp_fmt *fmt;
+ unsigned int width;
+ const char *sep = symbol_conf.field_sep;
+ bool first = true;
+ int line;
+
+ for (line = 0; line < hpp_list->nr_header_lines; line++) {
+ /* first # is displayed one level up */
+ if (line)
+ fprintf(fp, "# ");
+ fprintf_line(hists, hpp, line, fp);
+ fprintf(fp, "\n");
+ }
if (sep)
- return 1;
+ return hpp_list->nr_header_lines;
first = true;
@@ -689,7 +705,7 @@ hists__fprintf_standard_headers(struct hists *hists,
fprintf(fp, "\n");
fprintf(fp, "#\n");
- return 3;
+ return hpp_list->nr_header_lines + 2;
}
static int hists__fprintf_headers(struct hists *hists, FILE *fp)
--
2.7.4
Powered by blists - more mailing lists