perf trace: Sample timestamp and cpu when using record flag
authorLi Zefan <lizf@cn.fujitsu.com>
Thu, 17 Sep 2009 08:49:43 +0000 (16:49 +0800)
committerIngo Molnar <mingo@elte.hu>
Thu, 17 Sep 2009 22:30:25 +0000 (00:30 +0200)
Sample timestamp and cpu just like the -R option.

Before:
            init-0     [-01] 1266874889.17179869184709551615: irq_handler_entry: irq=18 handler=eth0
            init-0     [-01] 1266874889.17179869184709551615: irq_handler_entry: irq=18 handler=eth0
            init-0     [-01] 1266874889.17179869184709551615: irq_handler_entry: irq=1 handler=i8042
            init-0     [-01] 1266874889.17179869184709551615: irq_handler_entry: irq=18 handler=eth0
            init-0     [-01] 1266874889.17179869184709551615: irq_handler_entry: irq=1 handler=i8042

After:
            init-0     [001]  7364.568965353: irq_handler_entry: irq=18 handler=eth0
            init-0     [001]  7365.530226877: irq_handler_entry: irq=1 handler=i8042
            init-0     [001]  7365.542831563: irq_handler_entry: irq=18 handler=eth0
            init-0     [001]  7365.644156299: irq_handler_entry: irq=18 handler=eth0
            init-0     [001]  7365.694556201: irq_handler_entry: irq=18 handler=eth0

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <4AB1F827.8040905@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/util/parse-events.c

index 910283cbbc8f9eef54b66dfe34a367fa25944833..a9bdcab8c0702c5e0fd2134955b43bf8aa1b7d8e 100644 (file)
@@ -425,8 +425,11 @@ parse_single_tracepoint_event(char *sys_name,
        int fd;
 
        if (flags) {
-               if (!strncmp(flags, "record", strlen(flags)))
+               if (!strncmp(flags, "record", strlen(flags))) {
                        attr->sample_type |= PERF_SAMPLE_RAW;
+                       attr->sample_type |= PERF_SAMPLE_TIME;
+                       attr->sample_type |= PERF_SAMPLE_CPU;
+               }
        }
 
        snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path,