diff options
author | Ingo Molnar <mingo@kernel.org> | 2019-02-28 02:29:50 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-02-28 02:29:50 -0500 |
commit | c978b9460fe1d4a1e1effa0abd6bd69b18a098a8 (patch) | |
tree | eecc4c6179dea191c55ac8ef50467573b29a0b06 /tools/perf/scripts/python/syscall-counts-by-pid.py | |
parent | 0a1571243d3f150fa99c6f41f1b8e17a307a2b8b (diff) | |
parent | de667cce7f4f96b6e22da8fd9c065b961f355080 (diff) |
Merge tag 'perf-core-for-mingo-5.1-20190225' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
perf annotate:
Wei Li:
- Fix getting source line failure
perf script:
Andi Kleen:
- Handle missing fields with -F +...
perf data:
Jiri Olsa:
- Prep work to support per-cpu files in a directory.
Intel PT:
Adrian Hunter:
- Improve thread_stack__no_call_return()
- Hide x86 retpolines in thread stacks.
- exported SQL viewer refactorings, new 'top calls' report..
Alexander Shishkin:
- Copy parent's address filter offsets on clone
- Fix address filters for vmas with non-zero offset. Applies to
ARM's CoreSight as well.
python scripts:
Tony Jones:
- Python3 support for several 'perf script' python scripts.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts-by-pid.py')
-rw-r--r-- | tools/perf/scripts/python/syscall-counts-by-pid.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tools/perf/scripts/python/syscall-counts-by-pid.py b/tools/perf/scripts/python/syscall-counts-by-pid.py index daf314cc5dd3..42782487b0e9 100644 --- a/tools/perf/scripts/python/syscall-counts-by-pid.py +++ b/tools/perf/scripts/python/syscall-counts-by-pid.py | |||
@@ -5,6 +5,8 @@ | |||
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 | from __future__ import print_function | ||
9 | |||
8 | import os, sys | 10 | import os, sys |
9 | 11 | ||
10 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | 12 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ |
@@ -31,7 +33,7 @@ if len(sys.argv) > 1: | |||
31 | syscalls = autodict() | 33 | syscalls = autodict() |
32 | 34 | ||
33 | def trace_begin(): | 35 | def trace_begin(): |
34 | print "Press control+C to stop and show the summary" | 36 | print("Press control+C to stop and show the summary") |
35 | 37 | ||
36 | def trace_end(): | 38 | def trace_end(): |
37 | print_syscall_totals() | 39 | print_syscall_totals() |
@@ -55,20 +57,20 @@ def syscalls__sys_enter(event_name, context, common_cpu, | |||
55 | 57 | ||
56 | def print_syscall_totals(): | 58 | def print_syscall_totals(): |
57 | if for_comm is not None: | 59 | if for_comm is not None: |
58 | print "\nsyscall events for %s:\n\n" % (for_comm), | 60 | print("\nsyscall events for %s:\n" % (for_comm)) |
59 | else: | 61 | else: |
60 | print "\nsyscall events by comm/pid:\n\n", | 62 | print("\nsyscall events by comm/pid:\n") |
61 | 63 | ||
62 | print "%-40s %10s\n" % ("comm [pid]/syscalls", "count"), | 64 | print("%-40s %10s" % ("comm [pid]/syscalls", "count")) |
63 | print "%-40s %10s\n" % ("----------------------------------------", \ | 65 | print("%-40s %10s" % ("----------------------------------------", |
64 | "----------"), | 66 | "----------")) |
65 | 67 | ||
66 | comm_keys = syscalls.keys() | 68 | comm_keys = syscalls.keys() |
67 | for comm in comm_keys: | 69 | for comm in comm_keys: |
68 | pid_keys = syscalls[comm].keys() | 70 | pid_keys = syscalls[comm].keys() |
69 | for pid in pid_keys: | 71 | for pid in pid_keys: |
70 | print "\n%s [%d]\n" % (comm, pid), | 72 | print("\n%s [%d]" % (comm, pid)) |
71 | id_keys = syscalls[comm][pid].keys() | 73 | id_keys = syscalls[comm][pid].keys() |
72 | for id, val in sorted(syscalls[comm][pid].iteritems(), \ | 74 | for id, val in sorted(syscalls[comm][pid].items(), \ |
73 | key = lambda(k, v): (v, k), reverse = True): | 75 | key = lambda kv: (kv[1], kv[0]), reverse = True): |
74 | print " %-38s %10d\n" % (syscall_name(id), val), | 76 | print(" %-38s %10d" % (syscall_name(id), val)) |