aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/syscall-counts.py
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-02-28 02:29:50 -0500
committerIngo Molnar <mingo@kernel.org>2019-02-28 02:29:50 -0500
commitc978b9460fe1d4a1e1effa0abd6bd69b18a098a8 (patch)
treeeecc4c6179dea191c55ac8ef50467573b29a0b06 /tools/perf/scripts/python/syscall-counts.py
parent0a1571243d3f150fa99c6f41f1b8e17a307a2b8b (diff)
parentde667cce7f4f96b6e22da8fd9c065b961f355080 (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.py')
-rw-r--r--tools/perf/scripts/python/syscall-counts.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/perf/scripts/python/syscall-counts.py b/tools/perf/scripts/python/syscall-counts.py
index e66a7730aeb5..0ebd89cfd42c 100644
--- a/tools/perf/scripts/python/syscall-counts.py
+++ b/tools/perf/scripts/python/syscall-counts.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
8from __future__ import print_function
9
8import os 10import os
9import sys 11import sys
10 12
@@ -28,7 +30,7 @@ if len(sys.argv) > 1:
28syscalls = autodict() 30syscalls = autodict()
29 31
30def trace_begin(): 32def trace_begin():
31 print "Press control+C to stop and show the summary" 33 print("Press control+C to stop and show the summary")
32 34
33def trace_end(): 35def trace_end():
34 print_syscall_totals() 36 print_syscall_totals()
@@ -51,14 +53,14 @@ def syscalls__sys_enter(event_name, context, common_cpu,
51 53
52def print_syscall_totals(): 54def print_syscall_totals():
53 if for_comm is not None: 55 if for_comm is not None:
54 print "\nsyscall events for %s:\n\n" % (for_comm), 56 print("\nsyscall events for %s:\n" % (for_comm))
55 else: 57 else:
56 print "\nsyscall events:\n\n", 58 print("\nsyscall events:\n")
57 59
58 print "%-40s %10s\n" % ("event", "count"), 60 print("%-40s %10s" % ("event", "count"))
59 print "%-40s %10s\n" % ("----------------------------------------", \ 61 print("%-40s %10s" % ("----------------------------------------",
60 "-----------"), 62 "-----------"))
61 63
62 for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \ 64 for id, val in sorted(syscalls.items(), key = lambda kv: (kv[1], kv[0]), \
63 reverse = True): 65 reverse = True):
64 print "%-40s %10d\n" % (syscall_name(id), val), 66 print("%-40s %10d" % (syscall_name(id), val))