All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 3/5] perf tools tui: Display multiple header lines
Date: Sun,  7 Aug 2016 17:28:28 +0200	[thread overview]
Message-ID: <1470583710-1649-4-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1470583710-1649-1-git-send-email-jolsa@kernel.org>

Display multiple header lines in TUI browser, if it's
configured within struct perf_hpp_list::nr_header_lines.

Link: http://lkml.kernel.org/n/tip-g41e9c3nrex4vz9vfn7wbb1w@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/ui/browsers/hists.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 303ed62a8f53..4a7aac8ed5ee 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1502,7 +1502,9 @@ static int advance_hpp_check(struct perf_hpp *hpp, int inc)
 	return hpp->size <= 0;
 }
 
-static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf, size_t size)
+static int
+hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf,
+				 size_t size, int line)
 {
 	struct hists *hists = browser->hists;
 	struct perf_hpp dummy_hpp = {
@@ -1523,7 +1525,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *
 		if (perf_hpp__should_skip(fmt, hists)  || column++ < browser->b.horiz_scroll)
 			continue;
 
-		ret = fmt->header(fmt, &dummy_hpp, hists, 0);
+		ret = fmt->header(fmt, &dummy_hpp, hists, line);
 		if (advance_hpp_check(&dummy_hpp, ret))
 			break;
 
@@ -1628,14 +1630,21 @@ static void hists_browser__hierarchy_headers(struct hist_browser *browser)
 
 static void hists_browser__headers(struct hist_browser *browser)
 {
-	char headers[1024];
+	struct hists *hists = browser->hists;
+	struct perf_hpp_list *hpp_list = hists->hpp_list;
 
-	hists_browser__scnprintf_headers(browser, headers,
-					 sizeof(headers));
+	int line;
 
-	ui_browser__gotorc(&browser->b, 0, 0);
-	ui_browser__set_color(&browser->b, HE_COLORSET_ROOT);
-	ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1);
+	for (line = 0; line < hpp_list->nr_header_lines; line++) {
+		char headers[1024];
+
+		hists_browser__scnprintf_headers(browser, headers,
+						 sizeof(headers), line);
+
+		ui_browser__gotorc(&browser->b, line, 0);
+		ui_browser__set_color(&browser->b, HE_COLORSET_ROOT);
+		ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1);
+	}
 }
 
 static void hist_browser__show_headers(struct hist_browser *browser)
-- 
2.4.11

  parent reply	other threads:[~2016-08-07 15:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-07 15:28 [PATCH 0/5] perf tools: Add support for multiline headers and spans Jiri Olsa
2016-08-07 15:28 ` [PATCH 1/5] perf tools: Introduce nr_header_lines into struct perf_hpp_list Jiri Olsa
2016-08-24  9:19   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
2016-08-07 15:28 ` [PATCH 2/5] perf tools: Add line argument into perf_hpp_fmt's header callback Jiri Olsa
2016-08-24  9:19   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
2016-08-07 15:28 ` Jiri Olsa [this message]
2016-08-24  9:20   ` [tip:perf/core] perf tools tui: Display multiple header lines tip-bot for Jiri Olsa
2016-08-07 15:28 ` [PATCH 4/5] perf tools stdio: " Jiri Olsa
2016-08-24  9:20   ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-08-07 15:28 ` [PATCH 5/5] perf tools: Add support for header span Jiri Olsa
2016-08-24  9:21   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470583710-1649-4-git-send-email-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.