perf_counter: Add perf record option to log addresses
authorAnton Blanchard <anton@samba.org>
Thu, 16 Jul 2009 13:44:29 +0000 (15:44 +0200)
committerIngo Molnar <mingo@elte.hu>
Sat, 18 Jul 2009 09:21:32 +0000 (11:21 +0200)
Add the -d or --data option to log event addresses (eg page
faults).

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20090716104817.697698033@samba.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/builtin-record.c

index 072aaf0369f88cff9ef931b22f8fbcd5aa653b2f..68a9be0d1513760a9dad9f938473566544ce7885 100644 (file)
@@ -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()