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-acbe613e0c03d59cab21aec3565cdb28c7df98c3@git.kernel.org>
Date:	Wed, 24 Feb 2016 21:42:41 -0800
From:	tip-bot for Jiri Olsa <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	namhyung@...nel.org, acme@...hat.com, a.p.zijlstra@...llo.nl,
	mingo@...nel.org, linux-kernel@...r.kernel.org, ak@...ux.intel.com,
	jolsa@...nel.org, tglx@...utronix.de, dsahern@...il.com,
	hpa@...or.com, eranian@...gle.com
Subject: [tip:perf/core] perf tools: Add monitored events array

Commit-ID:  acbe613e0c03d59cab21aec3565cdb28c7df98c3
Gitweb:     http://git.kernel.org/tip/acbe613e0c03d59cab21aec3565cdb28c7df98c3
Author:     Jiri Olsa <jolsa@...nel.org>
AuthorDate: Mon, 15 Feb 2016 09:34:34 +0100
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 23 Feb 2016 12:11:06 -0300

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@...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/1455525293-8671-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-mem.c     | 17 +++++++++--------
 tools/perf/util/Build        |  1 +
 tools/perf/util/mem-events.c | 10 ++++++++++
 tools/perf/util/mem-events.h | 19 +++++++++++++++++++
 4 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 3901700..36c56a4 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];
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index a34752d..df2b690 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -82,6 +82,7 @@ libperf-y += parse-branch-options.o
 libperf-y += parse-regs-options.o
 libperf-y += term.o
 libperf-y += help-unknown-cmd.o
+libperf-y += mem-events.o
 
 libperf-$(CONFIG_LIBBPF) += bpf-loader.o
 libperf-$(CONFIG_BPF_PROLOGUE) += bpf-prologue.o
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
new file mode 100644
index 0000000..c6ba0a1
--- /dev/null
+++ b/tools/perf/util/mem-events.c
@@ -0,0 +1,10 @@
+#include "mem-events.h"
+
+#define E(n) { .name = n }
+
+struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX] = {
+	E("cpu/mem-loads,ldlat=30/P"),
+	E("cpu/mem-stores/P"),
+};
+
+#undef E
diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h
new file mode 100644
index 0000000..c97b214
--- /dev/null
+++ b/tools/perf/util/mem-events.h
@@ -0,0 +1,19 @@
+#ifndef __PERF_MEM_EVENTS_H
+#define __PERF_MEM_EVENTS_H
+
+#include <stdbool.h>
+
+struct perf_mem_event {
+	bool		record;
+	const char	*name;
+};
+
+enum {
+	PERF_MEM_EVENTS__LOAD,
+	PERF_MEM_EVENTS__STORE,
+	PERF_MEM_EVENTS__MAX,
+};
+
+extern struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX];
+
+#endif /* __PERF_MEM_EVENTS_H */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ