[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1455525293-8671-8-git-send-email-jolsa@kernel.org>
Date: Mon, 15 Feb 2016 09:34:37 +0100
From: Jiri Olsa <jolsa@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
David Ahern <dsahern@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Stephane Eranian <eranian@...gle.com>,
Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH 07/23] perf mem: Introduce perf_mem_events__name function
Wrap perf_mem_events[].name into perf_mem_events__name
function so we could alter the events name if needed.
This will be handy when changing latency settings for
loads event in following patch.
Link: http://lkml.kernel.org/n/tip-76wibzfbjamxfu7vapizsszj@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
tools/perf/builtin-mem.c | 4 ++--
tools/perf/util/mem-events.c | 5 +++++
tools/perf/util/mem-events.h | 1 +
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index e64e0aa7ba0e..26b2f9e0b153 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -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++)
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index e21853fe1312..0f62e930de13 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -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;
diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h
index b9a786346c03..23e3239dfa34 100644
--- a/tools/perf/util/mem-events.h
+++ b/tools/perf/util/mem-events.h
@@ -22,5 +22,6 @@ 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 */
--
2.4.3
Powered by blists - more mailing lists