All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, jolsa@kernel.org, namhyung@kernel.org,
	tglx@linutronix.de, dsahern@gmail.com, a.p.zijlstra@chello.nl,
	mingo@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com
Subject: [tip:perf/core] perf hists: Introduce nr_header_lines into struct perf_hpp_list
Date: Wed, 24 Aug 2016 02:19:10 -0700	[thread overview]
Message-ID: <tip-f8e6710de859e1ac3a5df294bddeca19f60cec9a@git.kernel.org> (raw)
In-Reply-To: <1470583710-1649-2-git-send-email-jolsa@kernel.org>

Commit-ID:  f8e6710de859e1ac3a5df294bddeca19f60cec9a
Gitweb:     http://git.kernel.org/tip/f8e6710de859e1ac3a5df294bddeca19f60cec9a
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Sun, 7 Aug 2016 17:28:26 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf hists: Introduce nr_header_lines into struct perf_hpp_list

Currently we support just single line headers, this is first step to
allow more.

Store the number of header lines in perf_hpp_list, which encompasses all
the display/sort entries and is thus suitable to hold this value.

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-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 15 ++++++++++++---
 tools/perf/ui/hist.c           |  1 +
 tools/perf/util/hist.h         |  1 +
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 13d4143..95f7cf1 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -69,8 +69,11 @@ static u32 hist_browser__nr_entries(struct hist_browser *hb)
 static void hist_browser__update_rows(struct hist_browser *hb)
 {
 	struct ui_browser *browser = &hb->b;
-	u16 header_offset = hb->show_headers ? 1 : 0, index_row;
+	struct hists *hists = hb->hists;
+	struct perf_hpp_list *hpp_list = hists->hpp_list;
+	u16 header_offset, index_row;
 
+	header_offset = hb->show_headers ? hpp_list->nr_header_lines : 0;
 	browser->rows = browser->height - header_offset;
 	/*
 	 * Verify if we were at the last line and that line isn't
@@ -99,8 +102,11 @@ static void hist_browser__refresh_dimensions(struct ui_browser *browser)
 
 static void hist_browser__gotorc(struct hist_browser *browser, int row, int column)
 {
-	u16 header_offset = browser->show_headers ? 1 : 0;
+	struct hists *hists = browser->hists;
+	struct perf_hpp_list *hpp_list = hists->hpp_list;
+	u16 header_offset;
 
+	header_offset = browser->show_headers ? hpp_list->nr_header_lines : 0;
 	ui_browser__gotorc(&browser->b, row + header_offset, column);
 }
 
@@ -1656,10 +1662,13 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser)
 	u16 header_offset = 0;
 	struct rb_node *nd;
 	struct hist_browser *hb = container_of(browser, struct hist_browser, b);
+	struct hists *hists = hb->hists;
 
 	if (hb->show_headers) {
+		struct perf_hpp_list *hpp_list = hists->hpp_list;
+
 		hist_browser__show_headers(hb);
-		header_offset = 1;
+		header_offset = hpp_list->nr_header_lines;
 	}
 
 	ui_browser__hists_init_top(browser);
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 4274969..be7a17f 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -441,6 +441,7 @@ struct perf_hpp_fmt perf_hpp__format[] = {
 struct perf_hpp_list perf_hpp_list = {
 	.fields	= LIST_HEAD_INIT(perf_hpp_list.fields),
 	.sorts	= LIST_HEAD_INIT(perf_hpp_list.sorts),
+	.nr_header_lines = 1,
 };
 
 #undef HPP__COLOR_PRINT_FNS
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 0a1edf1..8cc5d33 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -259,6 +259,7 @@ struct perf_hpp_list {
 	struct list_head fields;
 	struct list_head sorts;
 
+	int nr_header_lines;
 	int need_collapse;
 	int parent;
 	int sym;

  reply	other threads:[~2016-08-24  9:20 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-bot for Jiri Olsa [this message]
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 ` [PATCH 3/5] perf tools tui: Display multiple header lines Jiri Olsa
2016-08-24  9:20   ` [tip:perf/core] " 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=tip-f8e6710de859e1ac3a5df294bddeca19f60cec9a@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    /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.