2009-07-16 10:57:11

by Anton Blanchard

[permalink] [raw]
Subject: [patch 4/5] perf_counter: Add perf record option to log addresses.

Add the -d or --data option to log event addresses (eg page faults).

Signed-off-by: Anton Blanchard <[email protected]>
---

Index: linux.trees.git/tools/perf/builtin-record.c
===================================================================
--- linux.trees.git.orig/tools/perf/builtin-record.c 2009-07-15 11:31:53.000000000 +1000
+++ linux.trees.git/tools/perf/builtin-record.c 2009-07-15 11:34:26.000000000 +1000
@@ -43,6 +43,7 @@
static int verbose = 0;
static int inherit_stat = 0;
static int no_samples = 0;
+static int sample_address = 0;

static long samples;
static struct timeval last_read;
@@ -405,6 +406,9 @@
if (inherit_stat)
attr->inherit_stat = 1;

+ if (sample_address)
+ attr->sample_type |= PERF_SAMPLE_ADDR;
+
if (call_graph)
attr->sample_type |= PERF_SAMPLE_CALLCHAIN;

@@ -649,6 +653,8 @@
"be more verbose (show counter open errors, etc)"),
OPT_BOOLEAN('s', "stat", &inherit_stat,
"per thread counts"),
+ OPT_BOOLEAN('d', "data", &sample_address,
+ "Sample addresses"),
OPT_BOOLEAN('n', "no-samples", &no_samples,
"don't sample"),
OPT_END()

--


2009-07-18 09:51:10

by Anton Blanchard

[permalink] [raw]
Subject: [tip:perfcounters/urgent] perf_counter: Add perf record option to log addresses

Commit-ID: 4bba828dd9bb950ad1fe340ef148a5436a10f131
Gitweb: http://git.kernel.org/tip/4bba828dd9bb950ad1fe340ef148a5436a10f131
Author: Anton Blanchard <[email protected]>
AuthorDate: Thu, 16 Jul 2009 15:44:29 +0200
Committer: Ingo Molnar <[email protected]>
CommitDate: Sat, 18 Jul 2009 11:21:32 +0200

perf_counter: Add perf record option to log addresses

Add the -d or --data option to log event addresses (eg page
faults).

Signed-off-by: Anton Blanchard <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>


---
tools/perf/builtin-record.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 072aaf0..68a9be0 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -43,6 +43,7 @@ static int call_graph = 0;
static int verbose = 0;
static int inherit_stat = 0;
static int no_samples = 0;
+static int sample_address = 0;

static long samples;
static struct timeval last_read;
@@ -405,6 +406,9 @@ static void create_counter(int counter, int cpu, pid_t pid)
if (inherit_stat)
attr->inherit_stat = 1;

+ if (sample_address)
+ attr->sample_type |= PERF_SAMPLE_ADDR;
+
if (call_graph)
attr->sample_type |= PERF_SAMPLE_CALLCHAIN;

@@ -649,6 +653,8 @@ static const struct option options[] = {
"be more verbose (show counter open errors, etc)"),
OPT_BOOLEAN('s', "stat", &inherit_stat,
"per thread counts"),
+ OPT_BOOLEAN('d', "data", &sample_address,
+ "Sample addresses"),
OPT_BOOLEAN('n', "no-samples", &no_samples,
"don't sample"),
OPT_END()