Adding new 'paused' perf_event_attr attribute bit. It sets
the initial event state as paused, so it wont get started
until it's triggered by toggling mechanism.

Original-patch-by: Frederic Weisbecker <fweis...@gmail.com>
Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <a...@redhat.com>
Cc: Corey Ashford <cjash...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweis...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zijls...@chello.nl>
Cc: Arnaldo Carvalho de Melo <a...@redhat.com>
---
 include/uapi/linux/perf_event.h | 3 ++-
 kernel/events/core.c            | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index b941c21..1539c47 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -278,8 +278,9 @@ struct perf_event_attr {
                                exclude_callchain_kernel : 1, /* exclude kernel 
callchains */
                                exclude_callchain_user   : 1, /* exclude user 
callchains */
                                mmap2          :  1, /* include mmap with inode 
data     */
+                               paused         :  1, /* create as paused */
 
-                               __reserved_1   : 40;
+                               __reserved_1   : 39;
 
        union {
                __u32           wakeup_events;    /* wakeup every n events */
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 2c8ff93..f5f00a6 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6731,6 +6731,9 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
 
        event->state            = PERF_EVENT_STATE_INACTIVE;
 
+       if (attr->paused)
+               event->paused = true;
+
        if (task) {
                event->attach_state = PERF_ATTACH_TASK;
 
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to