From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755472AbcHXJVE (ORCPT ); Wed, 24 Aug 2016 05:21:04 -0400 Received: from terminus.zytor.com ([198.137.202.10]:43918 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754904AbcHXJU7 (ORCPT ); Wed, 24 Aug 2016 05:20:59 -0400 Date: Wed, 24 Aug 2016 02:20:40 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: hpa@zytor.com, dsahern@gmail.com, mingo@kernel.org, a.p.zijlstra@chello.nl, tglx@linutronix.de, jolsa@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, namhyung@kernel.org Reply-To: hpa@zytor.com, mingo@kernel.org, dsahern@gmail.com, tglx@linutronix.de, a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org, namhyung@kernel.org, acme@redhat.com, jolsa@kernel.org In-Reply-To: <1470583710-1649-5-git-send-email-jolsa@kernel.org> References: <1470583710-1649-5-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools stdio: Display multiple header lines Git-Commit-ID: f3705b062eafc2867eb0e9ee3502bd59564f103c X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f3705b062eafc2867eb0e9ee3502bd59564f103c Gitweb: http://git.kernel.org/tip/f3705b062eafc2867eb0e9ee3502bd59564f103c Author: Jiri Olsa AuthorDate: Sun, 7 Aug 2016 17:28:29 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 23 Aug 2016 15:37:33 -0300 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 Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1470583710-1649-5-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- 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 91b8e10..9b807cb 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)