Skip to content

Commit 0710087

Browse files
Daniel Bristot de Oliveiraacmel
authored andcommitted
perf scripts: Fallback to syscalls:* when raw_syscalls:* is not available
Older kernels (e.g., RHEL6) do system call tracing via the syscalls:sys_{enter,exit} tracepoints rather than using raw_syscalls:*. Update perf python and perl scripts to fallback to syscalls:* when raw_syscalls:* isn't available. Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Luis Claudio R. Goncalves <lgoncalv@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/5a6c64081a3375bc3bc66351b14559678ef4d71e.1402507908.git.bristot@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 1c92f88 commit 0710087

10 files changed

Lines changed: 35 additions & 5 deletions
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2-
perf record -e raw_syscalls:sys_exit $@
2+
(perf record -e raw_syscalls:sys_exit $@ || \
3+
perf record -e syscalls:sys_exit $@) 2> /dev/null

‎tools/perf/scripts/perl/failed-syscalls.pl‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ sub raw_syscalls::sys_exit
2626
}
2727
}
2828

29+
sub syscalls::sys_exit
30+
{
31+
raw_syscalls::sys_exit(@_)
32+
}
33+
2934
sub trace_end
3035
{
3136
printf("\nfailed syscalls by comm:\n\n");
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2-
perf record -e raw_syscalls:sys_exit $@
2+
(perf record -e raw_syscalls:sys_exit $@ || \
3+
perf record -e syscalls:sys_exit $@) 2> /dev/null
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2-
perf record -e raw_syscalls:sys_enter $@
2+
(perf record -e raw_syscalls:sys_enter $@ || \
3+
perf record -e syscalls:sys_enter $@) 2> /dev/null
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2-
perf record -e raw_syscalls:sys_enter $@
2+
(perf record -e raw_syscalls:sys_enter $@ || \
3+
perf record -e syscalls:sys_enter $@) 2> /dev/null
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2-
perf record -e raw_syscalls:sys_enter $@
2+
(perf record -e raw_syscalls:sys_enter $@ || \
3+
perf record -e syscalls:sys_enter $@) 2> /dev/null

‎tools/perf/scripts/python/failed-syscalls-by-pid.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ def raw_syscalls__sys_exit(event_name, context, common_cpu,
5050
except TypeError:
5151
syscalls[common_comm][common_pid][id][ret] = 1
5252

53+
def syscalls__sys_exit(event_name, context, common_cpu,
54+
common_secs, common_nsecs, common_pid, common_comm,
55+
id, ret):
56+
raw_syscalls__sys_exit(**locals())
57+
5358
def print_error_totals():
5459
if for_comm is not None:
5560
print "\nsyscall errors for %s:\n\n" % (for_comm),

‎tools/perf/scripts/python/sctop.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu,
5353
except TypeError:
5454
syscalls[id] = 1
5555

56+
def syscalls__sys_enter(event_name, context, common_cpu,
57+
common_secs, common_nsecs, common_pid, common_comm,
58+
id, args):
59+
raw_syscalls__sys_enter(**locals())
60+
5661
def print_syscall_totals(interval):
5762
while 1:
5863
clear_term()

‎tools/perf/scripts/python/syscall-counts-by-pid.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu,
4848
except TypeError:
4949
syscalls[common_comm][common_pid][id] = 1
5050

51+
def syscalls__sys_enter(event_name, context, common_cpu,
52+
common_secs, common_nsecs, common_pid, common_comm,
53+
id, args):
54+
raw_syscalls__sys_enter(**locals())
55+
5156
def print_syscall_totals():
5257
if for_comm is not None:
5358
print "\nsyscall events for %s:\n\n" % (for_comm),

‎tools/perf/scripts/python/syscall-counts.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu,
4444
except TypeError:
4545
syscalls[id] = 1
4646

47+
def syscalls__sys_enter(event_name, context, common_cpu,
48+
common_secs, common_nsecs, common_pid, common_comm,
49+
id, args):
50+
raw_syscalls__sys_enter(**locals())
51+
4752
def print_syscall_totals():
4853
if for_comm is not None:
4954
print "\nsyscall events for %s:\n\n" % (for_comm),

0 commit comments

Comments
 (0)