diff options
Diffstat (limited to 'tools/perf/scripts/python')
| -rw-r--r-- | tools/perf/scripts/python/sctop.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tools/perf/scripts/python/sctop.py b/tools/perf/scripts/python/sctop.py index 61621b93affb..987ffae7c8ca 100644 --- a/tools/perf/scripts/python/sctop.py +++ b/tools/perf/scripts/python/sctop.py | |||
| @@ -8,7 +8,14 @@ | |||
| 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 os, sys, thread, time | 11 | from __future__ import print_function |
| 12 | |||
| 13 | import os, sys, time | ||
| 14 | |||
| 15 | try: | ||
| 16 | import thread | ||
| 17 | except ImportError: | ||
| 18 | import _thread as thread | ||
| 12 | 19 | ||
| 13 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | 20 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ |
| 14 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') | 21 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') |
| @@ -62,18 +69,19 @@ def print_syscall_totals(interval): | |||
| 62 | while 1: | 69 | while 1: |
| 63 | clear_term() | 70 | clear_term() |
| 64 | if for_comm is not None: | 71 | if for_comm is not None: |
| 65 | print "\nsyscall events for %s:\n\n" % (for_comm), | 72 | print("\nsyscall events for %s:\n" % (for_comm)) |
| 66 | else: | 73 | else: |
| 67 | print "\nsyscall events:\n\n", | 74 | print("\nsyscall events:\n") |
| 68 | 75 | ||
| 69 | print "%-40s %10s\n" % ("event", "count"), | 76 | print("%-40s %10s" % ("event", "count")) |
| 70 | print "%-40s %10s\n" % ("----------------------------------------", \ | 77 | print("%-40s %10s" % |
| 71 | "----------"), | 78 | ("----------------------------------------", |
| 79 | "----------")) | ||
| 72 | 80 | ||
| 73 | for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \ | 81 | for id, val in sorted(syscalls.items(), key = lambda kv: (kv[1], kv[0]), \ |
| 74 | reverse = True): | 82 | reverse = True): |
| 75 | try: | 83 | try: |
| 76 | print "%-40s %10d\n" % (syscall_name(id), val), | 84 | print("%-40s %10d" % (syscall_name(id), val)) |
| 77 | except TypeError: | 85 | except TypeError: |
| 78 | pass | 86 | pass |
| 79 | syscalls.clear() | 87 | syscalls.clear() |
