summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-mem.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-02-15 09:34:34 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-02-23 16:11:06 +0100
commitacbe613e0c03d59cab21aec3565cdb28c7df98c3 (patch)
treef1f03f8ece7f3964f633870202689dcbbabd9850 /tools/perf/builtin-mem.c
parentperf tools: Introduce cl_offset function (diff)
downloadlinux-acbe613e0c03d59cab21aec3565cdb28c7df98c3.tar.xz
linux-acbe613e0c03d59cab21aec3565cdb28c7df98c3.zip
perf tools: Add monitored events array
It will ease up configuration of memory events and addition of other memory events in following patches. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1455525293-8671-5-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-mem.c')
-rw-r--r--tools/perf/builtin-mem.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 390170041696..36c56a4b778b 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -6,6 +6,7 @@
#include "util/tool.h"
#include "util/session.h"
#include "util/data.h"
+#include "util/mem-events.h"
#define MEM_OPERATION_LOAD 0x1
#define MEM_OPERATION_STORE 0x2
@@ -34,20 +35,20 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
rec_argv[i++] = "record";
- if (mem->operation & MEM_OPERATION_LOAD)
+ if (mem->operation & MEM_OPERATION_LOAD) {
+ perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true;
rec_argv[i++] = "-W";
+ }
rec_argv[i++] = "-d";
- if (mem->operation & MEM_OPERATION_LOAD) {
- rec_argv[i++] = "-e";
- rec_argv[i++] = "cpu/mem-loads/pp";
- }
+ for (j = 0; j < PERF_MEM_EVENTS__MAX; j++) {
+ if (!perf_mem_events[j].record)
+ continue;
- if (mem->operation & MEM_OPERATION_STORE) {
rec_argv[i++] = "-e";
- rec_argv[i++] = "cpu/mem-stores/pp";
- }
+ rec_argv[i++] = perf_mem_events[j].name;
+ };
for (j = 1; j < argc; j++, i++)
rec_argv[i] = argv[j];