lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-2ba7ac5814a6952aad647ce31696b893772cbe83@git.kernel.org>
Date:	Wed, 24 Feb 2016 23:36:51 -0800
From:	tip-bot for Jiri Olsa <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	dsahern@...il.com, a.p.zijlstra@...llo.nl, eranian@...gle.com,
	hpa@...or.com, linux-kernel@...r.kernel.org, ak@...ux.intel.com,
	jolsa@...nel.org, tglx@...utronix.de, acme@...hat.com,
	namhyung@...nel.org, mingo@...nel.org
Subject: [tip:perf/core] perf mem: Introduce perf_mem_events__name function

Commit-ID:  2ba7ac5814a6952aad647ce31696b893772cbe83
Gitweb:     http://git.kernel.org/tip/2ba7ac5814a6952aad647ce31696b893772cbe83
Author:     Jiri Olsa <jolsa@...nel.org>
AuthorDate: Wed, 24 Feb 2016 09:46:43 +0100
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 24 Feb 2016 10:11:52 -0300

perf mem: Introduce perf_mem_events__name function

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@...nel.org>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Stephane Eranian <eranian@...gle.com>
Link: http://lkml.kernel.org/r/1456303616-26926-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-mem.c     | 6 +++---
 tools/perf/util/mem-events.c | 5 +++++
 tools/perf/util/mem-events.h | 1 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index f1fa7b8..88aeac9 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -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++)
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index e21853f..2330db5 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 75c1660..2a91b95 100644
--- a/tools/perf/util/mem-events.h
+++ b/tools/perf/util/mem-events.h
@@ -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 */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ