[PATCH 00/12] add syscall tracepoints V3

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jason Baron
Date: Monday, August 10, 2009 - 1:52 pm

hi,

The following is an implementation of Frederic's syscall tracer on top of
tracepoints. It adds the ability to toggle the entry/exit of each syscall
via the standard events/syscalls/syscall_blah/enable interface. The
implementation is done by adding 2 tracepoints. One on entry and one for exit.

The patchset now also addes 'perf' tool support for counting the number of
syscall events. For example, I did a simple strace of 'cat'ing' a file, and
then verified that 'perf stat' gave a similar count.

For example:

#   perf stat -e syscalls:sys_enter_brk -e syscalls:sys_exit_brk -e syscalls:sys_enter_mmap -e syscalls:sys_enter_mmap -e syscalls:sys_enter_access -e syscalls:sys_exit_access  -e syscalls:sys_enter_close -e syscalls:sys_exit_close -e syscalls:sys_enter_read -e syscalls:sys_exit_read -e syscalls:sys_enter_write -e syscalls:sys_exit_write -e syscalls:sys_enter_mprotect -e syscalls:sys_exit_mprotect -e  syscalls:sys_enter_open -e syscalls:sys_exit_open -e syscalls:sys_enter_newfstat -e syscalls:sys_exit_newfstat -e syscalls:sys_enter_exit_group -e syscalls:sys_exit_exit_group cat /tmp/foo 


 Performance counter stats for 'cat /tmp/foo':

              3  syscalls:sys_enter_brk  
              3  syscalls:sys_exit_brk   
              9  syscalls:sys_enter_mmap 
              9  syscalls:sys_enter_mmap 
              1  syscalls:sys_enter_access
              1  syscalls:sys_exit_access
              6  syscalls:sys_enter_close
              6  syscalls:sys_exit_close 
              3  syscalls:sys_enter_read 
              3  syscalls:sys_exit_read  
              1  syscalls:sys_enter_write
              1  syscalls:sys_exit_write 
              3  syscalls:sys_enter_mprotect
              3  syscalls:sys_exit_mprotect
              4  syscalls:sys_enter_open 
              4  syscalls:sys_exit_open  
              5  syscalls:sys_enter_newfstat
              5  syscalls:sys_exit_newfstat
              1  syscalls:sys_enter_exit_group
              0  syscalls:sys_exit_exit_group

    0.000864861  seconds time elapsed


thanks,

-Jason


 arch/x86/include/asm/ftrace.h  |    4 +-
 arch/x86/kernel/ftrace.c       |   41 ++++--
 arch/x86/kernel/ptrace.c       |    6 +-
 arch/x86/kernel/sys_x86_64.c   |    8 +-
 include/linux/ftrace_event.h   |    5 +-
 include/linux/perf_counter.h   |    2 +
 include/linux/syscalls.h       |  125 ++++++++++++++++-
 include/linux/tracepoint.h     |   31 ++++-
 include/trace/ftrace.h         |    4 +-
 include/trace/syscall.h        |   54 ++++++--
 kernel/trace/trace.h           |    6 -
 kernel/trace/trace_events.c    |   33 +++--
 kernel/trace/trace_syscalls.c  |  311 ++++++++++++++++++++++++++++------------
 kernel/tracepoint.c            |   38 +++++
 tools/perf/util/parse-events.c |    8 +-
 15 files changed, 522 insertions(+), 154 deletions(-)

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/12] add syscall tracepoints V3, Jason Baron, (Mon Aug 10, 1:52 pm)
[PATCH 02/12] call arch_init_ftrace_syscalls at boot, Jason Baron, (Mon Aug 10, 1:52 pm)
[PATCH 03/12] add DECLARE_TRACE_WITH_CALLBACK() macro, Jason Baron, (Mon Aug 10, 1:52 pm)
[PATCH 04/12] add syscall tracepoints, Jason Baron, (Mon Aug 10, 1:52 pm)
[PATCH 05/12] update FTRACE_SYSCALL_MAX, Jason Baron, (Mon Aug 10, 1:52 pm)
[PATCH 06/12] trace_event - raw_init bailout, Jason Baron, (Mon Aug 10, 1:52 pm)
[PATCH 09/12] add support traceopint ids, Jason Baron, (Mon Aug 10, 1:52 pm)
[PATCH 10/12] add perf counter support, Jason Baron, (Mon Aug 10, 1:53 pm)
Re: [PATCH 07/12] add ftrace_event_call void * 'data' field, Frederic Weisbecker, (Tue Aug 11, 3:09 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Tue Aug 11, 3:50 am)
Re: [PATCH 05/12] update FTRACE_SYSCALL_MAX, Frederic Weisbecker, (Tue Aug 11, 4:00 am)
Re: [PATCH 09/12] add support traceopint ids, Frederic Weisbecker, (Tue Aug 11, 4:28 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Tue Aug 11, 5:01 am)
Re: [PATCH 10/12] add perf counter support, Frederic Weisbecker, (Tue Aug 11, 5:12 am)
Re: [PATCH 10/12] add perf counter support, Ingo Molnar, (Tue Aug 11, 5:17 am)
Re: [PATCH 10/12] add perf counter support, Frederic Weisbecker, (Tue Aug 11, 5:25 am)
Re: [PATCH 05/12] update FTRACE_SYSCALL_MAX, Matt Fleming, (Tue Aug 11, 12:39 pm)
Re: [PATCH 07/12] add ftrace_event_call void * 'data' field, Frederic Weisbecker, (Mon Aug 17, 4:09 pm)
Re: [PATCH 05/12] update FTRACE_SYSCALL_MAX, Paul Mundt, (Mon Aug 24, 6:41 am)
Re: [PATCH 05/12] update FTRACE_SYSCALL_MAX, Jason Baron, (Mon Aug 24, 7:06 am)
Re: [PATCH 05/12] update FTRACE_SYSCALL_MAX, Paul Mundt, (Mon Aug 24, 7:15 am)
Re: [PATCH 05/12] update FTRACE_SYSCALL_MAX, Frederic Weisbecker, (Mon Aug 24, 7:34 am)
Re: [PATCH 05/12] update FTRACE_SYSCALL_MAX, Paul Mundt, (Mon Aug 24, 7:37 am)
Re: [PATCH 05/12] update FTRACE_SYSCALL_MAX, Jason Baron, (Mon Aug 24, 7:42 am)
Re: [PATCH 05/12] update FTRACE_SYSCALL_MAX, Paul Mundt, (Mon Aug 24, 7:50 am)
Re: [PATCH 05/12] update FTRACE_SYSCALL_MAX, Ingo Molnar, (Mon Aug 24, 11:34 am)
Re: [PATCH 00/12] add syscall tracepoints V3 - s390 arch u ..., Hendrik Brueckner, (Tue Aug 25, 5:31 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Hendrik Brueckner, (Tue Aug 25, 5:50 am)
Re: [PATCH 00/12] add syscall tracepoints V3 - s390 arch u ..., Frederic Weisbecker, (Tue Aug 25, 6:52 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Tue Aug 25, 7:15 am)
Re: [PATCH 00/12] add syscall tracepoints V3 - s390 arch u ..., Hendrik Brueckner, (Tue Aug 25, 8:38 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Hendrik Brueckner, (Tue Aug 25, 9:02 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Mathieu Desnoyers, (Tue Aug 25, 9:20 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Tue Aug 25, 9:59 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Tue Aug 25, 10:31 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Mathieu Desnoyers, (Tue Aug 25, 11:15 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Mathieu Desnoyers, (Tue Aug 25, 11:31 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Tue Aug 25, 12:42 pm)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Mathieu Desnoyers, (Tue Aug 25, 12:51 pm)
Re: [PATCH 00/12] add syscall tracepoints V3 - s390 arch u ..., Frederic Weisbecker, (Tue Aug 25, 12:52 pm)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Tue Aug 25, 2:40 pm)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Martin Schwidefsky, (Tue Aug 25, 3:04 pm)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Tue Aug 25, 3:09 pm)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Tue Aug 25, 5:19 pm)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Mathieu Desnoyers, (Tue Aug 25, 5:42 pm)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Wed Aug 26, 5:32 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Wed Aug 26, 5:35 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Wed Aug 26, 6:30 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Wed Aug 26, 6:53 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Wed Aug 26, 7:27 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Hendrik Brueckner, (Wed Aug 26, 7:41 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Frederic Weisbecker, (Wed Aug 26, 9:14 am)
Re: [PATCH 00/12] add syscall tracepoints V3 - s390 arch u ..., Frederic Weisbecker, (Wed Aug 26, 9:53 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Mathieu Desnoyers, (Wed Aug 26, 10:08 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Mathieu Desnoyers, (Wed Aug 26, 10:10 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Mathieu Desnoyers, (Wed Aug 26, 10:11 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Christoph Hellwig, (Wed Aug 26, 11:41 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Christoph Hellwig, (Wed Aug 26, 11:42 am)
Re: [PATCH 08/12] add trace events for each syscall entry/exit, Mathieu Desnoyers, (Wed Aug 26, 12:01 pm)
[PATCH]: tracing: s390 arch updates for tracing syscalls, Hendrik Brueckner, (Thu Aug 27, 12:27 am)
[tip:tracing/core] tracing: Add syscall tracepoints - s390 ..., tip-bot for Hendrik ..., (Fri Aug 28, 5:27 am)
[tip:tracing/core] tracing: Check invalid syscall nr while ..., tip-bot for Hendrik ..., (Fri Aug 28, 5:27 am)
[tip:tracing/core] tracing: Don't trace kernel thread syscalls, tip-bot for Hendrik ..., (Fri Aug 28, 5:28 am)