aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2014-05-28 04:45:04 -0400
committerIngo Molnar <mingo@kernel.org>2014-06-06 01:56:22 -0400
commit82b897782d10fcc4930c9d4a15b175348fdd2871 (patch)
tree82bc0bb22ef1379b901d4fce582584b6776a91ea /include/uapi/linux
parentec00010972a0971b2c1da4fbe4e5c7d8ed1ecb05 (diff)
perf: Differentiate exec() and non-exec() comm events
perf tools like 'perf report' can aggregate samples by comm strings, which generally works. However, there are other potential use-cases. For example, to pair up 'calls' with 'returns' accurately (from branch events like Intel BTS) it is necessary to identify whether the process has exec'd. Although a comm event is generated when an 'exec' happens it is also generated whenever the comm string is changed on a whim (e.g. by prctl PR_SET_NAME). This patch adds a flag to the comm event to differentiate one case from the other. In order to determine whether the kernel supports the new flag, a selection bit named 'exec' is added to struct perf_event_attr. The bit does nothing but will cause perf_event_open() to fail if the bit is set on kernels that do not have it defined. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/537D9EBE.7030806@intel.com Cc: Paul Mackerras <paulus@samba.org> Cc: Dave Jones <davej@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/uapi/linux')
-rw-r--r--include/uapi/linux/perf_event.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index d9cd853818ad..5312fae47218 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -302,8 +302,8 @@ struct perf_event_attr {
302 exclude_callchain_kernel : 1, /* exclude kernel callchains */ 302 exclude_callchain_kernel : 1, /* exclude kernel callchains */
303 exclude_callchain_user : 1, /* exclude user callchains */ 303 exclude_callchain_user : 1, /* exclude user callchains */
304 mmap2 : 1, /* include mmap with inode data */ 304 mmap2 : 1, /* include mmap with inode data */
305 305 comm_exec : 1, /* flag comm events that are due to an exec */
306 __reserved_1 : 40; 306 __reserved_1 : 39;
307 307
308 union { 308 union {
309 __u32 wakeup_events; /* wakeup every n events */ 309 __u32 wakeup_events; /* wakeup every n events */
@@ -502,7 +502,12 @@ struct perf_event_mmap_page {
502#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) 502#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
503#define PERF_RECORD_MISC_GUEST_USER (5 << 0) 503#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
504 504
505/*
506 * PERF_RECORD_MISC_MMAP_DATA and PERF_RECORD_MISC_COMM_EXEC are used on
507 * different events so can reuse the same bit position.
508 */
505#define PERF_RECORD_MISC_MMAP_DATA (1 << 13) 509#define PERF_RECORD_MISC_MMAP_DATA (1 << 13)
510#define PERF_RECORD_MISC_COMM_EXEC (1 << 13)
506/* 511/*
507 * Indicates that the content of PERF_SAMPLE_IP points to 512 * Indicates that the content of PERF_SAMPLE_IP points to
508 * the actual instruction that triggered the event. See also 513 * the actual instruction that triggered the event. See also