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,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Andi Kleen <ak@linux.intel.com>, David Ahern <dsahern@gmail.com>,
	Don Zickus <dzickus@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	Jiri Olsa <jolsa@redhat.com>, Joe Mario <jmario@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Richard Fowles <rfowles@redhat.com>,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 02/26] perf mem: Move the mem_operations global to struct perf_mem
Date: Mon, 26 Jan 2015 14:47:05 -0300	[thread overview]
Message-ID: <1422294449-12735-3-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1422294449-12735-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Just like the other parameters, grouping it on the builtin-mem specific
config area: struct perf_mem.

Acked-by: Stephane Eranian <eranian@google.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Richard Fowles <rfowles@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ad8ns5l51ongemfsir3zy09x@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-mem.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 1eded0a3a509..9b5663950a4d 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -10,21 +10,17 @@
 #define MEM_OPERATION_LOAD	0x1
 #define MEM_OPERATION_STORE	0x2
 
-/*
- * default to both load an store sampling
- */
-static int mem_operation = MEM_OPERATION_LOAD | MEM_OPERATION_STORE;
-
 struct perf_mem {
 	struct perf_tool	tool;
 	char const		*input_name;
 	bool			hide_unresolved;
 	bool			dump_raw;
+	int			operation;
 	const char		*cpu_list;
 	DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
 };
 
-static int __cmd_record(int argc, const char **argv)
+static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
 {
 	int rec_argc, i = 0, j;
 	const char **rec_argv;
@@ -37,17 +33,17 @@ static int __cmd_record(int argc, const char **argv)
 
 	rec_argv[i++] = "record";
 
-	if (mem_operation & MEM_OPERATION_LOAD)
+	if (mem->operation & MEM_OPERATION_LOAD)
 		rec_argv[i++] = "-W";
 
 	rec_argv[i++] = "-d";
 
-	if (mem_operation & MEM_OPERATION_LOAD) {
+	if (mem->operation & MEM_OPERATION_LOAD) {
 		rec_argv[i++] = "-e";
 		rec_argv[i++] = "cpu/mem-loads/pp";
 	}
 
-	if (mem_operation & MEM_OPERATION_STORE) {
+	if (mem->operation & MEM_OPERATION_STORE) {
 		rec_argv[i++] = "-e";
 		rec_argv[i++] = "cpu/mem-stores/pp";
 	}
@@ -177,7 +173,7 @@ static int report_events(int argc, const char **argv, struct perf_mem *mem)
 	 * there is no weight (cost) associated with stores, so don't print
 	 * the column
 	 */
-	if (!(mem_operation & MEM_OPERATION_LOAD))
+	if (!(mem->operation & MEM_OPERATION_LOAD))
 		rep_argv[i++] = "--sort=mem,sym,dso,symbol_daddr,"
 				"dso_daddr,tlb,locked";
 
@@ -273,9 +269,13 @@ int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused)
 			.ordered_events	= true,
 		},
 		.input_name		 = "perf.data",
+		/*
+		 * default to both load an store sampling
+		 */
+		.operation		 = MEM_OPERATION_LOAD | MEM_OPERATION_STORE,
 	};
 	const struct option mem_options[] = {
-	OPT_CALLBACK('t', "type", &mem_operation,
+	OPT_CALLBACK('t', "type", &mem.operation,
 		   "type", "memory operations(load,store) Default load,store",
 		    parse_mem_ops),
 	OPT_BOOLEAN('D', "dump-raw-samples", &mem.dump_raw,
@@ -302,7 +302,7 @@ int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused)
 	argc = parse_options_subcommand(argc, argv, mem_options, mem_subcommands,
 					mem_usage, PARSE_OPT_STOP_AT_NON_OPTION);
 
-	if (!argc || !(strncmp(argv[0], "rec", 3) || mem_operation))
+	if (!argc || !(strncmp(argv[0], "rec", 3) || mem.operation))
 		usage_with_options(mem_usage, mem_options);
 
 	if (!mem.input_name || !strlen(mem.input_name)) {
@@ -313,7 +313,7 @@ int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused)
 	}
 
 	if (!strncmp(argv[0], "rec", 3))
-		return __cmd_record(argc, argv);
+		return __cmd_record(argc, argv, &mem);
 	else if (!strncmp(argv[0], "rep", 3))
 		return report_events(argc, argv, &mem);
 	else
-- 
1.9.3


  parent reply	other threads:[~2015-01-26 17:47 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 17:47 [GIT PULL 00/26] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-01-26 17:47 ` Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 01/26] perf mem: Enable sampling loads and stores simultaneously Arnaldo Carvalho de Melo
2015-01-26 17:47 ` Arnaldo Carvalho de Melo [this message]
2015-01-26 17:47 ` [PATCH 03/26] perf tools: Remove EOL whitespaces Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 04/26] perf hists: Rename hist_entry__free to __delete Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 05/26] perf hists: Introduce function for deleting/removing hist_entry Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 06/26] perf report: Get rid of report__inc_stat() Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 07/26] perf tools: Remove some unused functions from color.c Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 08/26] perf tools: Support parsing parameterized events Arnaldo Carvalho de Melo
2015-01-26 17:47   ` Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 09/26] perf tools: Extend format_alias() to include event parameters Arnaldo Carvalho de Melo
2015-01-26 17:47   ` Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 10/26] perf Documentation: Add " Arnaldo Carvalho de Melo
2015-01-26 17:47   ` Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 11/26] perf tools: Document parameterized and symbolic events Arnaldo Carvalho de Melo
2015-01-26 17:47   ` Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 12/26] perf tools: Allow use of an exclusive option more than once Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 13/26] perf diff: Get rid of hists__compute_resort() Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 14/26] perf diff: Print diff result more precisely Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 15/26] perf diff: Introduce fmt_to_data_file() helper Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 16/26] perf tools: Pass struct perf_hpp_fmt to its callbacks Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 17/26] perf diff: Fix output ordering to honor next column Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 18/26] perf diff: Fix -o/--order option behavior Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 19/26] tools lib fs: Adopt debugfs open strerrno method Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 20/26] tools lib fs: Pass filename to debugfs__strerror_open Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 21/26] perf trace: Fix error reporting for evsel pgfault constructor Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 22/26] tools lib fs debugfs: Introduce debugfs__strerror_open_tp Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 23/26] tools lib fs debugfs: Check if debugfs is mounted when handling ENOENT Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 24/26] perf tests: Fix typo in sample-parsing.c Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 25/26] perf ui/tui: Show fatal error message only if exists Arnaldo Carvalho de Melo
2015-01-26 17:47 ` [PATCH 26/26] tools lib traceevent: Add support for IP address formats Arnaldo Carvalho de Melo
2015-01-28 14:50 ` [GIT PULL 00/26] perf/core improvements and fixes Ingo Molnar
2015-01-28 14:50   ` Ingo Molnar
2015-01-28 14:55   ` Arnaldo Carvalho de Melo
2015-01-28 14:55     ` Arnaldo Carvalho de Melo

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=1422294449-12735-3-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=dzickus@redhat.com \
    --cc=eranian@google.com \
    --cc=jmario@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rfowles@redhat.com \
    /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.