All of lore.kernel.org
 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 06/27] perf hists browser: Introduce perf_evsel_browser constructor
Date: Thu, 23 Jun 2016 18:23:53 -0300	[thread overview]
Message-ID: <1466717054-31048-7-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1466717054-31048-1-git-send-email-acme@kernel.org>

From: Jiri Olsa <jolsa@kernel.org>

So we could use hist_browser__new for generic hist browser in following
patches.

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/1466459899-1166-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 24 +++++++++++++++++-------
 tools/perf/ui/browsers/hists.h |  4 +---
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index ccb9ed62a037..a81b298b79f9 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2042,9 +2042,7 @@ static int hist_browser__dump(struct hist_browser *browser)
 	return 0;
 }
 
-struct hist_browser *hist_browser__new(struct hists *hists,
-				       struct hist_browser_timer *hbt,
-				       struct perf_env *env)
+struct hist_browser *hist_browser__new(struct hists *hists)
 {
 	struct hist_browser *browser = zalloc(sizeof(*browser));
 
@@ -2057,9 +2055,6 @@ struct hist_browser *hist_browser__new(struct hists *hists,
 		browser->b.seek = ui_browser__hists_seek;
 		browser->b.use_navkeypressed = true;
 		browser->show_headers = symbol_conf.show_hist_headers;
-		browser->hbt = hbt;
-		browser->env = env;
-		browser->title = perf_evsel_browser_title;
 
 		hists__for_each_format(hists, fmt) {
 			perf_hpp__reset_width(fmt, hists);
@@ -2070,6 +2065,21 @@ struct hist_browser *hist_browser__new(struct hists *hists,
 	return browser;
 }
 
+static struct hist_browser *
+perf_evsel_browser__new(struct perf_evsel *evsel,
+			struct hist_browser_timer *hbt,
+			struct perf_env *env)
+{
+	struct hist_browser *browser = hist_browser__new(evsel__hists(evsel));
+
+	if (browser) {
+		browser->hbt   = hbt;
+		browser->env   = env;
+		browser->title = perf_evsel_browser_title;
+	}
+	return browser;
+}
+
 void hist_browser__delete(struct hist_browser *browser)
 {
 	free(browser);
@@ -2652,7 +2662,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 				    struct perf_env *env)
 {
 	struct hists *hists = evsel__hists(evsel);
-	struct hist_browser *browser = hist_browser__new(hists, hbt, env);
+	struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env);
 	struct branch_info *bi;
 #define MAX_OPTIONS  16
 	char *options[MAX_OPTIONS];
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
index cf9d04928ccc..ec55a511d910 100644
--- a/tools/perf/ui/browsers/hists.h
+++ b/tools/perf/ui/browsers/hists.h
@@ -24,9 +24,7 @@ struct hist_browser {
 			     char *bf, size_t size);
 };
 
-struct hist_browser *hist_browser__new(struct hists *hists,
-				       struct hist_browser_timer *hbt,
-				       struct perf_env *env);
+struct hist_browser *hist_browser__new(struct hists *hists);
 void hist_browser__delete(struct hist_browser *browser);
 int hist_browser__run(struct hist_browser *browser, const char *help);
 #endif /* _PERF_UI_BROWSER_HISTS_H_ */
-- 
2.5.5

  parent reply	other threads:[~2016-06-23 21:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 21:23 [GIT PULL 00/27] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 01/27] perf script stackcollapse: Remove reference to the perl interpreter Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 02/27] perf hists browser: Move hist_browser into header file Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 03/27] perf hists browser: Make (new|delete|run) public Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 04/27] perf hists browser: Introduce struct hist_browser title callback Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 05/27] perf hists browser: Move horizontal scroll init to new() Arnaldo Carvalho de Melo
2016-06-23 21:23 ` Arnaldo Carvalho de Melo [this message]
2016-06-23 21:23 ` [PATCH 07/27] perf hists browser: Introduce init() Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 08/27] perf hists: Enlarge pid sort entry size Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 09/27] perf evlist: Destructors should accept NULL Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 10/27] perf session: " Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 11/27] perf tests time-to-tsc: No need to disable an event before deleting it Arnaldo Carvalho de Melo
2016-06-23 21:23 ` [PATCH 12/27] perf machine: Destructors should accept NULL Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 13/27] perf tools: Let python use correct gcc for build_ext Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 14/27] perf config: Move config declarations from util/cache.h to util/config.h Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 15/27] perf tools: Find right DSO taking into account if binary is 32 or 64-bit Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 16/27] perf unwind: Change macro names of perf register Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 17/27] perf unwind: Fix wrongly used regs for x86_32 unwind Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 18/27] perf unwind: Fix wrongly used regs for aarch64 unwind Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 19/27] perf evlist: Rename for_each() macros to for_each_entry() Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 20/27] perf tools: Rename strlist_for_each() " Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 21/27] perf rb_resort: Rename for_each() " Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 22/27] perf intlist: " Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 23/27] perf script: Print sample flags more nicely Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 24/27] perf auxtrace: Add option to feed branches to the thread stack Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 25/27] perf script: Add callindent option Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 26/27] perf config: Introduce new init() and exit() Arnaldo Carvalho de Melo
2016-06-23 21:24 ` [PATCH 27/27] perf config: Reimplement show_config() using config_set__for_each Arnaldo Carvalho de Melo
2016-06-26 10:43 ` [GIT PULL 00/27] perf/core improvements and fixes 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=1466717054-31048-7-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 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.