perf_counter: Add fork event
Subsystems (3)
Commit-ID: 60313ebed739b331e8e61079da27a11ee3b73a30 Gitweb: http://git.kernel.org/tip/60313ebed739b331e8e61079da27a11ee3b73a30 Author: Peter Zijlstra <[email protected]> AuthorDate: Thu, 4 Jun 2009 16:53:44 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 4 Jun 2009 17:51:38 +0200
perf_counter: Add fork event
Create a fork event so that we can easily clone the comm and dso maps without having to generate all those events.
Signed-off-by Peter Zijlstra <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by Ingo Molnar <[email protected]>
--- include/linux/perf_counter.h | 10 +++ kernel/fork.c | 4 +- kernel/perf_counter.c | 131 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 126 insertions(+), 19 deletions(-)
include/linux/perf_counter.h +10 -0
@@ -277,6 +277,14 @@ enum perf_event_type {PERF_EVENT_UNTHROTTLE =6 ,/* +* struct { +* struct perf_event_header header; +* u32 pid, ppid; +* }; +*/ + PERF_EVENT_FORK = 7, + +/* * When header.misc & PERF_EVENT_MISC_OVERFLOW the event_type field * will be PERF_RECORD_* *
@@ -618,6 +626,7 @@ extern void perf_counter_munmap(unsigned long addr, unsigned long len, unsigned long pgoff, struct file *file);extern void perf_counter_comm (struct task_struct *tsk); +extern void perf_counter_fork (struct task_struct *tsk);extern void perf_counter_task_migration (struct task_struct *task,int cpu);
@@ -673,6 +682,7 @@ perf_counter_munmap(unsigned long addr, unsigned long len, unsigned long pgoff, struct file *file) { }static inline void perf_counter_comm (struct task_struct *tsk) { } +static inline void perf_counter_fork (struct task_struct *tsk) { }static inline void perf_counter_init (void ) { }static inline void perf_counter_task_migration (struct task_struct *task,int cpu) { }
kernel/fork.c +2 -2
@@ -1412,12 +1412,12 @@ long do_fork(unsigned long clone_flags,if (clone_flags &CLONE_VFORK ) { p->vfork_done = &vfork;init_completion (&vfork); - }else { + }else if (!(clone_flags &CLONE_VM )) {/* * vfork will do an exec which will call * set_task_comm() */ -perf_counter_comm (p); +perf_counter_fork (p); }audit_finish_fork (p);
kernel/perf_counter.c +114 -17
190 lines not on this page · raw message