]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
perf mem: Introduce perf_mem_events__name function
authorJiri Olsa <jolsa@kernel.org>
Wed, 24 Feb 2016 08:46:43 +0000 (09:46 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 24 Feb 2016 13:11:52 +0000 (10:11 -0300)
Wrap perf_mem_events[].name into perf_mem_events__name() so we could alter the
events name if needed.

This will be handy when changing latency settings for loads event in following
patch.

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/1456303616-26926-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-mem.c
tools/perf/util/mem-events.c
tools/perf/util/mem-events.h

index f1fa7b8d1f6949f23383482f88a6fad178d05d2c..88aeac9aa1da12c664ec64ee419d6ce48c5ad8ec 100644 (file)
@@ -43,7 +43,7 @@ static int parse_record_events(const struct option *opt,
                fprintf(stderr, "%-13s%-*s%s\n",
                        e->tag,
                        verbose ? 25 : 0,
-                       verbose ? e->name : "",
+                       verbose ? perf_mem_events__name(j) : "",
                        e->supported ? ": available" : "");
        }
        exit(0);
@@ -95,12 +95,12 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
 
                if (!perf_mem_events[j].supported) {
                        pr_err("failed: event '%s' not supported\n",
-                              perf_mem_events[j].name);
+                              perf_mem_events__name(j));
                        return -1;
                }
 
                rec_argv[i++] = "-e";
-               rec_argv[i++] = perf_mem_events[j].name;
+               rec_argv[i++] = perf_mem_events__name(j);
        };
 
        for (j = 0; j < argc; j++, i++)
index e21853fe1312ce1bc5dcfe1529cb44708ee73913..2330db510976ea57d506f203a7de594073234c77 100644 (file)
@@ -19,6 +19,11 @@ struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX] = {
 
 #undef E
 
+char *perf_mem_events__name(int i)
+{
+       return (char *)perf_mem_events[i].name;
+}
+
 int perf_mem_events__parse(const char *str)
 {
        char *tok, *saveptr = NULL;
index 75c1660bda627cdbe3069735cb7b8c4714553a22..2a91b959de6272222a7bbb17843970a0cf9e617a 100644 (file)
@@ -22,4 +22,5 @@ extern struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX];
 int perf_mem_events__parse(const char *str);
 int perf_mem_events__init(void);
 
+char *perf_mem_events__name(int i);
 #endif /* __PERF_MEM_EVENTS_H */