diff options
| author | Ingo Molnar <mingo@elte.hu> | 2010-10-26 03:30:22 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-10-26 03:30:22 -0400 |
| commit | 5df414c61e1b6f15bdc3759f292c7404286c9827 (patch) | |
| tree | 41b50a595fc53de595edcc20b350c048ce2856fc | |
| parent | 0b849ee88846e3488a34007c5b8b4249579ff159 (diff) | |
| parent | 7f6c1bd50d73d12f8b4ea09edb4515997f6527f5 (diff) | |
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/urgent
20 files changed, 106 insertions, 40 deletions
diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt index 43e3dd284b90..399751befeed 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt | |||
| @@ -15,6 +15,23 @@ DESCRIPTION | |||
| 15 | This command displays the symbolic event types which can be selected in the | 15 | This command displays the symbolic event types which can be selected in the |
| 16 | various perf commands with the -e option. | 16 | various perf commands with the -e option. |
| 17 | 17 | ||
| 18 | EVENT MODIFIERS | ||
| 19 | --------------- | ||
| 20 | |||
| 21 | Events can optionally have a modifer by appending a colon and one or | ||
| 22 | more modifiers. Modifiers allow the user to restrict when events are | ||
| 23 | counted with 'u' for user-space, 'k' for kernel, 'h' for hypervisor. | ||
| 24 | |||
| 25 | The 'p' modifier can be used for specifying how precise the instruction | ||
| 26 | address should be. The 'p' modifier is currently only implemented for | ||
| 27 | Intel PEBS and can be specified multiple times: | ||
| 28 | 0 - SAMPLE_IP can have arbitrary skid | ||
| 29 | 1 - SAMPLE_IP must have constant skid | ||
| 30 | 2 - SAMPLE_IP requested to have 0 skid | ||
| 31 | 3 - SAMPLE_IP must have 0 skid | ||
| 32 | |||
| 33 | The PEBS implementation now supports up to 2. | ||
| 34 | |||
| 18 | RAW HARDWARE EVENT DESCRIPTOR | 35 | RAW HARDWARE EVENT DESCRIPTOR |
| 19 | ----------------------------- | 36 | ----------------------------- |
| 20 | Even when an event is not available in a symbolic form within perf right now, | 37 | Even when an event is not available in a symbolic form within perf right now, |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 40a6a2992d15..deda1a93131e 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
| @@ -46,9 +46,6 @@ static struct scripting_ops *scripting_ops; | |||
| 46 | 46 | ||
| 47 | static void setup_scripting(void) | 47 | static void setup_scripting(void) |
| 48 | { | 48 | { |
| 49 | /* make sure PERF_EXEC_PATH is set for scripts */ | ||
| 50 | perf_set_argv_exec_path(perf_exec_path()); | ||
| 51 | |||
| 52 | setup_perl_scripting(); | 49 | setup_perl_scripting(); |
| 53 | setup_python_scripting(); | 50 | setup_python_scripting(); |
| 54 | 51 | ||
| @@ -285,7 +282,7 @@ static int parse_scriptname(const struct option *opt __used, | |||
| 285 | script++; | 282 | script++; |
| 286 | } else { | 283 | } else { |
| 287 | script = str; | 284 | script = str; |
| 288 | ext = strchr(script, '.'); | 285 | ext = strrchr(script, '.'); |
| 289 | if (!ext) { | 286 | if (!ext) { |
| 290 | fprintf(stderr, "invalid script extension"); | 287 | fprintf(stderr, "invalid script extension"); |
| 291 | return -1; | 288 | return -1; |
| @@ -593,6 +590,9 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used) | |||
| 593 | suffix = REPORT_SUFFIX; | 590 | suffix = REPORT_SUFFIX; |
| 594 | } | 591 | } |
| 595 | 592 | ||
| 593 | /* make sure PERF_EXEC_PATH is set for scripts */ | ||
| 594 | perf_set_argv_exec_path(perf_exec_path()); | ||
| 595 | |||
| 596 | if (!suffix && argc >= 2 && strncmp(argv[1], "-", strlen("-")) != 0) { | 596 | if (!suffix && argc >= 2 && strncmp(argv[1], "-", strlen("-")) != 0) { |
| 597 | char *record_script_path, *report_script_path; | 597 | char *record_script_path, *report_script_path; |
| 598 | int live_pipe[2]; | 598 | int live_pipe[2]; |
diff --git a/tools/perf/scripts/perl/bin/failed-syscalls-report b/tools/perf/scripts/perl/bin/failed-syscalls-report index e3a5e55d54ff..4028d92dc4ae 100644 --- a/tools/perf/scripts/perl/bin/failed-syscalls-report +++ b/tools/perf/scripts/perl/bin/failed-syscalls-report | |||
| @@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then | |||
| 7 | shift | 7 | shift |
| 8 | fi | 8 | fi |
| 9 | fi | 9 | fi |
| 10 | perf trace $@ -s ~/libexec/perf-core/scripts/perl/failed-syscalls.pl $comm | 10 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/failed-syscalls.pl $comm |
diff --git a/tools/perf/scripts/perl/bin/rw-by-file-report b/tools/perf/scripts/perl/bin/rw-by-file-report index d83070b7eeb5..ba25f4d41fb0 100644 --- a/tools/perf/scripts/perl/bin/rw-by-file-report +++ b/tools/perf/scripts/perl/bin/rw-by-file-report | |||
| @@ -7,7 +7,7 @@ if [ $# -lt 1 ] ; then | |||
| 7 | fi | 7 | fi |
| 8 | comm=$1 | 8 | comm=$1 |
| 9 | shift | 9 | shift |
| 10 | perf trace $@ -s ~/libexec/perf-core/scripts/perl/rw-by-file.pl $comm | 10 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-file.pl $comm |
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
diff --git a/tools/perf/scripts/perl/bin/rw-by-pid-report b/tools/perf/scripts/perl/bin/rw-by-pid-report index 7ef46983f62f..641a3f5d085c 100644 --- a/tools/perf/scripts/perl/bin/rw-by-pid-report +++ b/tools/perf/scripts/perl/bin/rw-by-pid-report | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | # description: system-wide r/w activity | 2 | # description: system-wide r/w activity |
| 3 | perf trace $@ -s ~/libexec/perf-core/scripts/perl/rw-by-pid.pl | 3 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-pid.pl |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
diff --git a/tools/perf/scripts/perl/bin/rwtop-report b/tools/perf/scripts/perl/bin/rwtop-report index 93e698cd3f38..4918dba77021 100644 --- a/tools/perf/scripts/perl/bin/rwtop-report +++ b/tools/perf/scripts/perl/bin/rwtop-report | |||
| @@ -17,7 +17,7 @@ if [ "$n_args" -gt 0 ] ; then | |||
| 17 | interval=$1 | 17 | interval=$1 |
| 18 | shift | 18 | shift |
| 19 | fi | 19 | fi |
| 20 | perf trace $@ -s ~/libexec/perf-core/scripts/perl/rwtop.pl $interval | 20 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rwtop.pl $interval |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | 23 | ||
diff --git a/tools/perf/scripts/perl/bin/wakeup-latency-report b/tools/perf/scripts/perl/bin/wakeup-latency-report index a0d898f9ca1d..49052ebcb632 100644 --- a/tools/perf/scripts/perl/bin/wakeup-latency-report +++ b/tools/perf/scripts/perl/bin/wakeup-latency-report | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | # description: system-wide min/max/avg wakeup latency | 2 | # description: system-wide min/max/avg wakeup latency |
| 3 | perf trace $@ -s ~/libexec/perf-core/scripts/perl/wakeup-latency.pl | 3 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/wakeup-latency.pl |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
diff --git a/tools/perf/scripts/perl/bin/workqueue-stats-report b/tools/perf/scripts/perl/bin/workqueue-stats-report index 35081132ef97..df0c65f4ca93 100644 --- a/tools/perf/scripts/perl/bin/workqueue-stats-report +++ b/tools/perf/scripts/perl/bin/workqueue-stats-report | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | # description: workqueue stats (ins/exe/create/destroy) | 2 | # description: workqueue stats (ins/exe/create/destroy) |
| 3 | perf trace $@ -s ~/libexec/perf-core/scripts/perl/workqueue-stats.pl | 3 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/workqueue-stats.pl |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py index 9689bc0acd9f..99ff1b7a0d2c 100644 --- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py +++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | # Public License ("GPL") version 2 as published by the Free Software | 6 | # Public License ("GPL") version 2 as published by the Free Software |
| 7 | # Foundation. | 7 | # Foundation. |
| 8 | 8 | ||
| 9 | import errno, os | ||
| 10 | |||
| 9 | NSECS_PER_SEC = 1000000000 | 11 | NSECS_PER_SEC = 1000000000 |
| 10 | 12 | ||
| 11 | def avg(total, n): | 13 | def avg(total, n): |
| @@ -26,3 +28,41 @@ def nsecs_str(nsecs): | |||
| 26 | 28 | ||
| 27 | def clear_term(): | 29 | def clear_term(): |
| 28 | print("\x1b[H\x1b[2J") | 30 | print("\x1b[H\x1b[2J") |
| 31 | |||
| 32 | audit_package_warned = False | ||
| 33 | |||
| 34 | try: | ||
| 35 | import audit | ||
| 36 | machine_to_id = { | ||
| 37 | 'x86_64': audit.MACH_86_64, | ||
| 38 | 'alpha' : audit.MACH_ALPHA, | ||
| 39 | 'ia64' : audit.MACH_IA64, | ||
| 40 | 'ppc' : audit.MACH_PPC, | ||
| 41 | 'ppc64' : audit.MACH_PPC64, | ||
| 42 | 's390' : audit.MACH_S390, | ||
| 43 | 's390x' : audit.MACH_S390X, | ||
| 44 | 'i386' : audit.MACH_X86, | ||
| 45 | 'i586' : audit.MACH_X86, | ||
| 46 | 'i686' : audit.MACH_X86, | ||
| 47 | } | ||
| 48 | try: | ||
| 49 | machine_to_id['armeb'] = audit.MACH_ARMEB | ||
| 50 | except: | ||
| 51 | pass | ||
| 52 | machine_id = machine_to_id[os.uname()[4]] | ||
| 53 | except: | ||
| 54 | if not audit_package_warned: | ||
| 55 | audit_package_warned = True | ||
| 56 | print "Install the audit-libs-python package to get syscall names" | ||
| 57 | |||
| 58 | def syscall_name(id): | ||
| 59 | try: | ||
| 60 | return audit.audit_syscall_to_name(id, machine_id) | ||
| 61 | except: | ||
| 62 | return str(id) | ||
| 63 | |||
| 64 | def strerror(nr): | ||
| 65 | try: | ||
| 66 | return errno.errorcode[abs(nr)] | ||
| 67 | except: | ||
| 68 | return "Unknown %d errno" % nr | ||
diff --git a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report index 30293545fcc2..03587021463d 100644 --- a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report +++ b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report | |||
| @@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then | |||
| 7 | shift | 7 | shift |
| 8 | fi | 8 | fi |
| 9 | fi | 9 | fi |
| 10 | perf trace $@ -s ~/libexec/perf-core/scripts/python/failed-syscalls-by-pid.py $comm | 10 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/failed-syscalls-by-pid.py $comm |
diff --git a/tools/perf/scripts/python/bin/netdev-times-report b/tools/perf/scripts/python/bin/netdev-times-report index c3d0a638123d..4ad361b31249 100644 --- a/tools/perf/scripts/python/bin/netdev-times-report +++ b/tools/perf/scripts/python/bin/netdev-times-report | |||
| @@ -2,4 +2,4 @@ | |||
| 2 | # description: display a process of packet and processing time | 2 | # description: display a process of packet and processing time |
| 3 | # args: [tx] [rx] [dev=] [debug] | 3 | # args: [tx] [rx] [dev=] [debug] |
| 4 | 4 | ||
| 5 | perf trace -s ~/libexec/perf-core/scripts/python/netdev-times.py $@ | 5 | perf trace -s "$PERF_EXEC_PATH"/scripts/python/netdev-times.py $@ |
diff --git a/tools/perf/scripts/python/bin/sched-migration-report b/tools/perf/scripts/python/bin/sched-migration-report index 61d05f72e443..df1791f07c24 100644 --- a/tools/perf/scripts/python/bin/sched-migration-report +++ b/tools/perf/scripts/python/bin/sched-migration-report | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | # description: sched migration overview | 2 | # description: sched migration overview |
| 3 | perf trace $@ -s ~/libexec/perf-core/scripts/python/sched-migration.py | 3 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/sched-migration.py |
diff --git a/tools/perf/scripts/python/bin/sctop-report b/tools/perf/scripts/python/bin/sctop-report index b01c842ae7b4..36b409c05e50 100644 --- a/tools/perf/scripts/python/bin/sctop-report +++ b/tools/perf/scripts/python/bin/sctop-report | |||
| @@ -21,4 +21,4 @@ elif [ "$n_args" -gt 0 ] ; then | |||
| 21 | interval=$1 | 21 | interval=$1 |
| 22 | shift | 22 | shift |
| 23 | fi | 23 | fi |
| 24 | perf trace $@ -s ~/libexec/perf-core/scripts/python/sctop.py $comm $interval | 24 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/sctop.py $comm $interval |
diff --git a/tools/perf/scripts/python/bin/syscall-counts-by-pid-report b/tools/perf/scripts/python/bin/syscall-counts-by-pid-report index 9e9d8ddd72ce..4eb88c9fc83c 100644 --- a/tools/perf/scripts/python/bin/syscall-counts-by-pid-report +++ b/tools/perf/scripts/python/bin/syscall-counts-by-pid-report | |||
| @@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then | |||
| 7 | shift | 7 | shift |
| 8 | fi | 8 | fi |
| 9 | fi | 9 | fi |
| 10 | perf trace $@ -s ~/libexec/perf-core/scripts/python/syscall-counts-by-pid.py $comm | 10 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/syscall-counts-by-pid.py $comm |
diff --git a/tools/perf/scripts/python/bin/syscall-counts-report b/tools/perf/scripts/python/bin/syscall-counts-report index dc076b618796..cb2f9c5cf17e 100644 --- a/tools/perf/scripts/python/bin/syscall-counts-report +++ b/tools/perf/scripts/python/bin/syscall-counts-report | |||
| @@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then | |||
| 7 | shift | 7 | shift |
| 8 | fi | 8 | fi |
| 9 | fi | 9 | fi |
| 10 | perf trace $@ -s ~/libexec/perf-core/scripts/python/syscall-counts.py $comm | 10 | perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/syscall-counts.py $comm |
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), |
diff --git a/tools/perf/scripts/python/sctop.py b/tools/perf/scripts/python/sctop.py index 6cafad40c296..547cbe99de68 100644 --- a/tools/perf/scripts/python/sctop.py +++ b/tools/perf/scripts/python/sctop.py | |||
| @@ -8,10 +8,7 @@ | |||
| 8 | # will be refreshed every [interval] seconds. The default interval is | 8 | # will be refreshed every [interval] seconds. The default interval is |
| 9 | # 3 seconds. | 9 | # 3 seconds. |
| 10 | 10 | ||
| 11 | import thread | 11 | import os, sys, thread, time |
| 12 | import time | ||
| 13 | import os | ||
| 14 | import sys | ||
| 15 | 12 | ||
| 16 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | 13 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ |
| 17 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') | 14 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') |
| @@ -71,7 +68,7 @@ def print_syscall_totals(interval): | |||
| 71 | for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \ | 68 | for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \ |
| 72 | reverse = True): | 69 | reverse = True): |
| 73 | try: | 70 | try: |
| 74 | print "%-40d %10d\n" % (id, val), | 71 | print "%-40s %10d\n" % (syscall_name(id), val), |
| 75 | except TypeError: | 72 | except TypeError: |
| 76 | pass | 73 | pass |
| 77 | syscalls.clear() | 74 | syscalls.clear() |
diff --git a/tools/perf/scripts/python/syscall-counts-by-pid.py b/tools/perf/scripts/python/syscall-counts-by-pid.py index af722d6a4b3f..d1ee3ec10cf2 100644 --- a/tools/perf/scripts/python/syscall-counts-by-pid.py +++ b/tools/perf/scripts/python/syscall-counts-by-pid.py | |||
| @@ -5,29 +5,33 @@ | |||
| 5 | # Displays system-wide system call totals, broken down by syscall. | 5 | # Displays system-wide system call totals, broken down by syscall. |
| 6 | # If a [comm] arg is specified, only syscalls called by [comm] are displayed. | 6 | # If a [comm] arg is specified, only syscalls called by [comm] are displayed. |
| 7 | 7 | ||
| 8 | import os | 8 | import os, sys |
| 9 | import sys | ||
| 10 | 9 | ||
| 11 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | 10 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ |
| 12 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') | 11 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') |
| 13 | 12 | ||
| 14 | from perf_trace_context import * | 13 | from perf_trace_context import * |
| 15 | from Core import * | 14 | from Core import * |
| 15 | from Util import syscall_name | ||
| 16 | 16 | ||
| 17 | usage = "perf trace -s syscall-counts-by-pid.py [comm]\n"; | 17 | usage = "perf trace -s syscall-counts-by-pid.py [comm]\n"; |
| 18 | 18 | ||
| 19 | for_comm = None | 19 | for_comm = None |
| 20 | for_pid = None | ||
| 20 | 21 | ||
| 21 | if len(sys.argv) > 2: | 22 | if len(sys.argv) > 2: |
| 22 | sys.exit(usage) | 23 | sys.exit(usage) |
| 23 | 24 | ||
| 24 | if len(sys.argv) > 1: | 25 | if len(sys.argv) > 1: |
| 25 | for_comm = sys.argv[1] | 26 | try: |
| 27 | for_pid = int(sys.argv[1]) | ||
| 28 | except: | ||
| 29 | for_comm = sys.argv[1] | ||
| 26 | 30 | ||
| 27 | syscalls = autodict() | 31 | syscalls = autodict() |
| 28 | 32 | ||
| 29 | def trace_begin(): | 33 | def trace_begin(): |
| 30 | pass | 34 | print "Press control+C to stop and show the summary" |
| 31 | 35 | ||
| 32 | def trace_end(): | 36 | def trace_end(): |
| 33 | print_syscall_totals() | 37 | print_syscall_totals() |
| @@ -35,9 +39,10 @@ def trace_end(): | |||
| 35 | def raw_syscalls__sys_enter(event_name, context, common_cpu, | 39 | def raw_syscalls__sys_enter(event_name, context, common_cpu, |
| 36 | common_secs, common_nsecs, common_pid, common_comm, | 40 | common_secs, common_nsecs, common_pid, common_comm, |
| 37 | id, args): | 41 | id, args): |
| 38 | if for_comm is not None: | 42 | |
| 39 | if common_comm != for_comm: | 43 | if (for_comm and common_comm != for_comm) or \ |
| 40 | return | 44 | (for_pid and common_pid != for_pid ): |
| 45 | return | ||
| 41 | try: | 46 | try: |
| 42 | syscalls[common_comm][common_pid][id] += 1 | 47 | syscalls[common_comm][common_pid][id] += 1 |
| 43 | except TypeError: | 48 | except TypeError: |
| @@ -61,4 +66,4 @@ def print_syscall_totals(): | |||
| 61 | id_keys = syscalls[comm][pid].keys() | 66 | id_keys = syscalls[comm][pid].keys() |
| 62 | for id, val in sorted(syscalls[comm][pid].iteritems(), \ | 67 | for id, val in sorted(syscalls[comm][pid].iteritems(), \ |
| 63 | key = lambda(k, v): (v, k), reverse = True): | 68 | key = lambda(k, v): (v, k), reverse = True): |
| 64 | print " %-38d %10d\n" % (id, val), | 69 | print " %-38s %10d\n" % (syscall_name(id), val), |
diff --git a/tools/perf/scripts/python/syscall-counts.py b/tools/perf/scripts/python/syscall-counts.py index f977e85ff049..ea183dc82d29 100644 --- a/tools/perf/scripts/python/syscall-counts.py +++ b/tools/perf/scripts/python/syscall-counts.py | |||
| @@ -13,6 +13,7 @@ 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 syscall_name | ||
| 16 | 17 | ||
| 17 | usage = "perf trace -s syscall-counts.py [comm]\n"; | 18 | usage = "perf trace -s syscall-counts.py [comm]\n"; |
| 18 | 19 | ||
| @@ -27,7 +28,7 @@ if len(sys.argv) > 1: | |||
| 27 | syscalls = autodict() | 28 | syscalls = autodict() |
| 28 | 29 | ||
| 29 | def trace_begin(): | 30 | def trace_begin(): |
| 30 | pass | 31 | print "Press control+C to stop and show the summary" |
| 31 | 32 | ||
| 32 | def trace_end(): | 33 | def trace_end(): |
| 33 | print_syscall_totals() | 34 | print_syscall_totals() |
| @@ -55,4 +56,4 @@ def print_syscall_totals(): | |||
| 55 | 56 | ||
| 56 | for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \ | 57 | for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \ |
| 57 | reverse = True): | 58 | reverse = True): |
| 58 | print "%-40d %10d\n" % (id, val), | 59 | print "%-40s %10d\n" % (syscall_name(id), val), |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index c20bd52833aa..3991d73d1cff 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
| @@ -1731,7 +1731,8 @@ static int line_range_search_cb(Dwarf_Die *sp_die, void *data) | |||
| 1731 | struct line_finder *lf = param->data; | 1731 | struct line_finder *lf = param->data; |
| 1732 | struct line_range *lr = lf->lr; | 1732 | struct line_range *lr = lf->lr; |
| 1733 | 1733 | ||
| 1734 | pr_debug("find (%lx) %s\n", dwarf_dieoffset(sp_die), | 1734 | pr_debug("find (%llx) %s\n", |
| 1735 | (unsigned long long)dwarf_dieoffset(sp_die), | ||
| 1735 | dwarf_diename(sp_die)); | 1736 | dwarf_diename(sp_die)); |
| 1736 | if (dwarf_tag(sp_die) == DW_TAG_subprogram && | 1737 | if (dwarf_tag(sp_die) == DW_TAG_subprogram && |
| 1737 | die_compare_name(sp_die, lr->function)) { | 1738 | die_compare_name(sp_die, lr->function)) { |
