diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-12-17 11:53:27 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-01-21 11:24:31 -0500 |
commit | 6602412215c26cd94af1b78fef56b78a5027b19b (patch) | |
tree | 9533483b7ed9ef15af75dc686c74617def23c079 /tools/perf | |
parent | 67121f85e464d66596f99afd8d188c1ae892f8fb (diff) |
perf mem: Move the mem_operations global to struct perf_mem
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>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-mem.c | 26 |
1 files 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 @@ | |||
10 | #define MEM_OPERATION_LOAD 0x1 | 10 | #define MEM_OPERATION_LOAD 0x1 |
11 | #define MEM_OPERATION_STORE 0x2 | 11 | #define MEM_OPERATION_STORE 0x2 |
12 | 12 | ||
13 | /* | ||
14 | * default to both load an store sampling | ||
15 | */ | ||
16 | static int mem_operation = MEM_OPERATION_LOAD | MEM_OPERATION_STORE; | ||
17 | |||
18 | struct perf_mem { | 13 | struct perf_mem { |
19 | struct perf_tool tool; | 14 | struct perf_tool tool; |
20 | char const *input_name; | 15 | char const *input_name; |
21 | bool hide_unresolved; | 16 | bool hide_unresolved; |
22 | bool dump_raw; | 17 | bool dump_raw; |
18 | int operation; | ||
23 | const char *cpu_list; | 19 | const char *cpu_list; |
24 | DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); | 20 | DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); |
25 | }; | 21 | }; |
26 | 22 | ||
27 | static int __cmd_record(int argc, const char **argv) | 23 | static int __cmd_record(int argc, const char **argv, struct perf_mem *mem) |
28 | { | 24 | { |
29 | int rec_argc, i = 0, j; | 25 | int rec_argc, i = 0, j; |
30 | const char **rec_argv; | 26 | const char **rec_argv; |
@@ -37,17 +33,17 @@ static int __cmd_record(int argc, const char **argv) | |||
37 | 33 | ||
38 | rec_argv[i++] = "record"; | 34 | rec_argv[i++] = "record"; |
39 | 35 | ||
40 | if (mem_operation & MEM_OPERATION_LOAD) | 36 | if (mem->operation & MEM_OPERATION_LOAD) |
41 | rec_argv[i++] = "-W"; | 37 | rec_argv[i++] = "-W"; |
42 | 38 | ||
43 | rec_argv[i++] = "-d"; | 39 | rec_argv[i++] = "-d"; |
44 | 40 | ||
45 | if (mem_operation & MEM_OPERATION_LOAD) { | 41 | if (mem->operation & MEM_OPERATION_LOAD) { |
46 | rec_argv[i++] = "-e"; | 42 | rec_argv[i++] = "-e"; |
47 | rec_argv[i++] = "cpu/mem-loads/pp"; | 43 | rec_argv[i++] = "cpu/mem-loads/pp"; |
48 | } | 44 | } |
49 | 45 | ||
50 | if (mem_operation & MEM_OPERATION_STORE) { | 46 | if (mem->operation & MEM_OPERATION_STORE) { |
51 | rec_argv[i++] = "-e"; | 47 | rec_argv[i++] = "-e"; |
52 | rec_argv[i++] = "cpu/mem-stores/pp"; | 48 | rec_argv[i++] = "cpu/mem-stores/pp"; |
53 | } | 49 | } |
@@ -177,7 +173,7 @@ static int report_events(int argc, const char **argv, struct perf_mem *mem) | |||
177 | * there is no weight (cost) associated with stores, so don't print | 173 | * there is no weight (cost) associated with stores, so don't print |
178 | * the column | 174 | * the column |
179 | */ | 175 | */ |
180 | if (!(mem_operation & MEM_OPERATION_LOAD)) | 176 | if (!(mem->operation & MEM_OPERATION_LOAD)) |
181 | rep_argv[i++] = "--sort=mem,sym,dso,symbol_daddr," | 177 | rep_argv[i++] = "--sort=mem,sym,dso,symbol_daddr," |
182 | "dso_daddr,tlb,locked"; | 178 | "dso_daddr,tlb,locked"; |
183 | 179 | ||
@@ -273,9 +269,13 @@ int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused) | |||
273 | .ordered_events = true, | 269 | .ordered_events = true, |
274 | }, | 270 | }, |
275 | .input_name = "perf.data", | 271 | .input_name = "perf.data", |
272 | /* | ||
273 | * default to both load an store sampling | ||
274 | */ | ||
275 | .operation = MEM_OPERATION_LOAD | MEM_OPERATION_STORE, | ||
276 | }; | 276 | }; |
277 | const struct option mem_options[] = { | 277 | const struct option mem_options[] = { |
278 | OPT_CALLBACK('t', "type", &mem_operation, | 278 | OPT_CALLBACK('t', "type", &mem.operation, |
279 | "type", "memory operations(load,store) Default load,store", | 279 | "type", "memory operations(load,store) Default load,store", |
280 | parse_mem_ops), | 280 | parse_mem_ops), |
281 | OPT_BOOLEAN('D', "dump-raw-samples", &mem.dump_raw, | 281 | 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) | |||
302 | argc = parse_options_subcommand(argc, argv, mem_options, mem_subcommands, | 302 | argc = parse_options_subcommand(argc, argv, mem_options, mem_subcommands, |
303 | mem_usage, PARSE_OPT_STOP_AT_NON_OPTION); | 303 | mem_usage, PARSE_OPT_STOP_AT_NON_OPTION); |
304 | 304 | ||
305 | if (!argc || !(strncmp(argv[0], "rec", 3) || mem_operation)) | 305 | if (!argc || !(strncmp(argv[0], "rec", 3) || mem.operation)) |
306 | usage_with_options(mem_usage, mem_options); | 306 | usage_with_options(mem_usage, mem_options); |
307 | 307 | ||
308 | if (!mem.input_name || !strlen(mem.input_name)) { | 308 | 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) | |||
313 | } | 313 | } |
314 | 314 | ||
315 | if (!strncmp(argv[0], "rec", 3)) | 315 | if (!strncmp(argv[0], "rec", 3)) |
316 | return __cmd_record(argc, argv); | 316 | return __cmd_record(argc, argv, &mem); |
317 | else if (!strncmp(argv[0], "rep", 3)) | 317 | else if (!strncmp(argv[0], "rep", 3)) |
318 | return report_events(argc, argv, &mem); | 318 | return report_events(argc, argv, &mem); |
319 | else | 319 | else |