linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
	David Ahern <dsahern@gmail.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 17/19] perf hists: Replace perf_evsel arg perf_hpp_fmt's width callback
Date: Wed, 15 Jun 2016 15:13:26 -0300	[thread overview]
Message-ID: <1466014408-12086-18-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1466014408-12086-1-git-send-email-acme@kernel.org>

From: Jiri Olsa <jolsa@kernel.org>

Replacing perf_evsel arg perf_hpp_fmt's width callback with hists
object.

This will be helpful in future for non evsel related hist browsers.

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

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index b75ea770d443..7f628f9c2fb4 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -1056,7 +1056,7 @@ static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 
 static int hpp__width(struct perf_hpp_fmt *fmt,
 		      struct perf_hpp *hpp __maybe_unused,
-		      struct perf_evsel *evsel __maybe_unused)
+		      struct hists *hists __maybe_unused)
 {
 	struct diff_hpp_fmt *dfmt =
 		container_of(fmt, struct diff_hpp_fmt, fmt);
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index c20425d7d9ae..b1b60544a545 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1470,7 +1470,7 @@ static int hist_browser__show_no_entry(struct hist_browser *browser,
 		    column++ < browser->b.horiz_scroll)
 			continue;
 
-		ret = fmt->width(fmt, NULL, hists_to_evsel(browser->hists));
+		ret = fmt->width(fmt, NULL, browser->hists);
 
 		if (first) {
 			/* for folded sign */
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 0b232d61310c..6940745aa77c 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -215,9 +215,10 @@ static int __hpp__sort_acc(struct hist_entry *a, struct hist_entry *b,
 
 static int hpp__width_fn(struct perf_hpp_fmt *fmt,
 			 struct perf_hpp *hpp __maybe_unused,
-			 struct perf_evsel *evsel)
+			 struct hists *hists)
 {
 	int len = fmt->user_len ?: fmt->len;
+	struct perf_evsel *evsel = hists_to_evsel(hists);
 
 	if (symbol_conf.event_group)
 		len = max(len, evsel->nr_members * fmt->len);
@@ -231,7 +232,7 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,
 static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 			  struct hists *hists)
 {
-	int len = hpp__width_fn(fmt, hpp, hists_to_evsel(hists));
+	int len = hpp__width_fn(fmt, hpp, hists);
 	return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name);
 }
 
@@ -632,7 +633,7 @@ unsigned int hists__sort_list_width(struct hists *hists)
 		else
 			ret += 2;
 
-		ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
+		ret += fmt->width(fmt, &dummy_hpp, hists);
 	}
 
 	if (verbose && hists__has(hists, sym)) /* Addr + origin */
@@ -657,7 +658,7 @@ unsigned int hists__overhead_width(struct hists *hists)
 		else
 			ret += 2;
 
-		ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
+		ret += fmt->width(fmt, &dummy_hpp, hists);
 	}
 
 	return ret;
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index d0534fac46ae..f04a63112079 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -590,7 +590,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
 			fprintf(fp, "%s", sep ?: "..");
 		first_col = false;
 
-		width = fmt->width(fmt, hpp, hists_to_evsel(hists));
+		width = fmt->width(fmt, hpp, hists);
 		fprintf(fp, "%.*s", width, dots);
 	}
 
@@ -607,7 +607,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
 				width++;  /* for '+' sign between column header */
 			first_col = false;
 
-			width += fmt->width(fmt, hpp, hists_to_evsel(hists));
+			width += fmt->width(fmt, hpp, hists);
 		}
 
 		if (width > header_width)
@@ -682,7 +682,7 @@ hists__fprintf_standard_headers(struct hists *hists,
 		else
 			first = false;
 
-		width = fmt->width(fmt, hpp, hists_to_evsel(hists));
+		width = fmt->width(fmt, hpp, hists);
 		for (i = 0; i < width; i++)
 			fprintf(fp, ".");
 	}
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index d1f19e0012d4..2515cfdb7365 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1081,7 +1081,7 @@ int hist_entry__snprintf_alignment(struct hist_entry *he, struct perf_hpp *hpp,
 				   struct perf_hpp_fmt *fmt, int printed)
 {
 	if (!list_is_last(&fmt->list, &he->hists->hpp_list->fields)) {
-		const int width = fmt->width(fmt, hpp, hists_to_evsel(he->hists));
+		const int width = fmt->width(fmt, hpp, he->hists);
 		if (printed < width) {
 			advance_hpp(hpp, printed);
 			printed = scnprintf(hpp->buf, hpp->size, "%-*s", width - printed, " ");
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index aae932f9eb87..a19112872ff9 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -217,7 +217,7 @@ struct perf_hpp_fmt {
 	int (*header)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 		      struct hists *hists);
 	int (*width)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-		     struct perf_evsel *evsel);
+		     struct hists *hists);
 	int (*color)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 		     struct hist_entry *he);
 	int (*entry)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 3e52c77981e3..896d34ebcc1e 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1503,7 +1503,7 @@ static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 
 static int __sort__hpp_width(struct perf_hpp_fmt *fmt,
 			     struct perf_hpp *hpp __maybe_unused,
-			     struct perf_evsel *evsel)
+			     struct hists *hists)
 {
 	struct hpp_sort_entry *hse;
 	size_t len = fmt->user_len;
@@ -1511,7 +1511,7 @@ static int __sort__hpp_width(struct perf_hpp_fmt *fmt,
 	hse = container_of(fmt, struct hpp_sort_entry, hpp);
 
 	if (!len)
-		len = hists__col_len(evsel__hists(evsel), hse->se->se_width_idx);
+		len = hists__col_len(hists, hse->se->se_width_idx);
 
 	return len;
 }
@@ -1808,7 +1808,7 @@ static int __sort__hde_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 
 static int __sort__hde_width(struct perf_hpp_fmt *fmt,
 			     struct perf_hpp *hpp __maybe_unused,
-			     struct perf_evsel *evsel __maybe_unused)
+			     struct hists *hists __maybe_unused)
 {
 	struct hpp_dynamic_entry *hde;
 	size_t len = fmt->user_len;
-- 
2.5.5

  parent reply	other threads:[~2016-06-15 18:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 18:13 [GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 01/19] perf config: Handle NULL at perf_config_set__delete() Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 02/19] perf tools: Fix rm_rf() to handle non-regular files correctly Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 03/19] perf probe: Fix to add NULL check for strndup Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 04/19] perf buildid: Rename and export build_id_cache__cachedir() Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 05/19] perf probe: Add perf_probe_event__copy() Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 06/19] perf probe: Uncomment and export synthesize_perf_probe_point() Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 07/19] perf unwind: Fix compile error for static cross build Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 08/19] perf mem: Add --ldlat option Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 09/19] perf tools: Fix Data Object sort entry width index Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 10/19] perf tui: Separate hierarchy and standard headers output Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 11/19] perf stdio: Separate " Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 12/19] perf stdio: Separate hierarchy " Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 13/19] perf stdio: Separate standard " Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 14/19] perf stdio: Do not pass hists in hist_entry__fprintf Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 15/19] perf stdio: Add use_callchain parameter to hists__fprintf Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 16/19] perf hists: Replace perf_evsel arg perf_hpp_fmt's header callback Arnaldo Carvalho de Melo
2016-06-15 18:13 ` Arnaldo Carvalho de Melo [this message]
2016-06-15 18:13 ` [PATCH 18/19] perf probe: Introduce perf_cache interfaces Arnaldo Carvalho de Melo
2016-06-15 18:13 ` [PATCH 19/19] perf probe: Add --cache option to cache the probe definitions Arnaldo Carvalho de Melo
2016-06-16  6:29 ` [GIT PULL 00/19] perf/core improvements and fixes Jiri Olsa
2016-06-16 19:54   ` Arnaldo Carvalho de Melo
2016-06-16  8:29 ` Ingo Molnar

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=1466014408-12086-18-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).