diff options
| author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2010-11-16 14:06:22 -0500 |
|---|---|---|
| committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2010-11-16 14:06:22 -0500 |
| commit | 20b4755e4fbb226eb42951bd40b53fcbce9ef944 (patch) | |
| tree | 43da70e0b32ee423d3643ecd422821383411ab72 /tools/perf/scripts/python/failed-syscalls-by-pid.py | |
| parent | 744f9f104ea262de1dc3e29265870c649f0d9473 (diff) | |
| parent | e53beacd23d9cb47590da6a7a7f6d417b941a994 (diff) | |
Merge commit 'v2.6.37-rc2' into upstream/xenfs
* commit 'v2.6.37-rc2': (10093 commits)
Linux 2.6.37-rc2
capabilities/syslog: open code cap_syslog logic to fix build failure
i2c: Sanity checks on adapter registration
i2c: Mark i2c_adapter.id as deprecated
i2c: Drivers shouldn't include <linux/i2c-id.h>
i2c: Delete unused adapter IDs
i2c: Remove obsolete cleanup for clientdata
include/linux/kernel.h: Move logging bits to include/linux/printk.h
Fix gcc 4.5.1 miscompiling drivers/char/i8k.c (again)
hwmon: (w83795) Check for BEEP pin availability
hwmon: (w83795) Clear intrusion alarm immediately
hwmon: (w83795) Read the intrusion state properly
hwmon: (w83795) Print the actual temperature channels as sources
hwmon: (w83795) List all usable temperature sources
hwmon: (w83795) Expose fan control method
hwmon: (w83795) Fix fan control mode attributes
hwmon: (lm95241) Check validity of input values
hwmon: Change mail address of Hans J. Koch
PCI: sysfs: fix printk warnings
GFS2: Fix inode deallocation race
...
Diffstat (limited to 'tools/perf/scripts/python/failed-syscalls-by-pid.py')
| -rw-r--r-- | tools/perf/scripts/python/failed-syscalls-by-pid.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tools/perf/scripts/python/failed-syscalls-by-pid.py b/tools/perf/scripts/python/failed-syscalls-by-pid.py index 0ca02278fe69..acd7848717b3 100644 --- a/tools/perf/scripts/python/failed-syscalls-by-pid.py +++ b/tools/perf/scripts/python/failed-syscalls-by-pid.py | |||
| @@ -13,21 +13,26 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | |||
| 13 | 13 | ||
| 14 | from perf_trace_context import * | 14 | from perf_trace_context import * |
| 15 | from Core import * | 15 | from Core import * |
| 16 | from Util import * | ||
| 16 | 17 | ||
| 17 | usage = "perf trace -s syscall-counts-by-pid.py [comm]\n"; | 18 | usage = "perf trace -s syscall-counts-by-pid.py [comm|pid]\n"; |
| 18 | 19 | ||
| 19 | for_comm = None | 20 | for_comm = None |
| 21 | for_pid = None | ||
| 20 | 22 | ||
| 21 | if len(sys.argv) > 2: | 23 | if len(sys.argv) > 2: |
| 22 | sys.exit(usage) | 24 | sys.exit(usage) |
| 23 | 25 | ||
| 24 | if len(sys.argv) > 1: | 26 | if len(sys.argv) > 1: |
| 25 | for_comm = sys.argv[1] | 27 | try: |
| 28 | for_pid = int(sys.argv[1]) | ||
| 29 | except: | ||
| 30 | for_comm = sys.argv[1] | ||
| 26 | 31 | ||
| 27 | syscalls = autodict() | 32 | syscalls = autodict() |
| 28 | 33 | ||
| 29 | def trace_begin(): | 34 | def trace_begin(): |
| 30 | pass | 35 | print "Press control+C to stop and show the summary" |
| 31 | 36 | ||
| 32 | def trace_end(): | 37 | def trace_end(): |
| 33 | print_error_totals() | 38 | print_error_totals() |
| @@ -35,9 +40,9 @@ def trace_end(): | |||
| 35 | def raw_syscalls__sys_exit(event_name, context, common_cpu, | 40 | def raw_syscalls__sys_exit(event_name, context, common_cpu, |
| 36 | common_secs, common_nsecs, common_pid, common_comm, | 41 | common_secs, common_nsecs, common_pid, common_comm, |
| 37 | id, ret): | 42 | id, ret): |
| 38 | if for_comm is not None: | 43 | if (for_comm and common_comm != for_comm) or \ |
| 39 | if common_comm != for_comm: | 44 | (for_pid and common_pid != for_pid ): |
| 40 | return | 45 | return |
| 41 | 46 | ||
| 42 | if ret < 0: | 47 | if ret < 0: |
| 43 | try: | 48 | try: |
| @@ -62,7 +67,7 @@ def print_error_totals(): | |||
| 62 | print "\n%s [%d]\n" % (comm, pid), | 67 | print "\n%s [%d]\n" % (comm, pid), |
| 63 | id_keys = syscalls[comm][pid].keys() | 68 | id_keys = syscalls[comm][pid].keys() |
| 64 | for id in id_keys: | 69 | for id in id_keys: |
| 65 | print " syscall: %-16d\n" % (id), | 70 | print " syscall: %-16s\n" % syscall_name(id), |
| 66 | ret_keys = syscalls[comm][pid][id].keys() | 71 | ret_keys = syscalls[comm][pid][id].keys() |
| 67 | for ret, val in sorted(syscalls[comm][pid][id].iteritems(), key = lambda(k, v): (v, k), reverse = True): | 72 | for ret, val in sorted(syscalls[comm][pid][id].iteritems(), key = lambda(k, v): (v, k), reverse = True): |
| 68 | print " err = %-20d %10d\n" % (ret, val), | 73 | print " err = %-20s %10d\n" % (strerror(ret), val), |
