summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/sctop.py
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyuw@linux.intel.com>2019-04-16 11:50:34 +0300
committerZhenyu Wang <zhenyuw@linux.intel.com>2019-04-16 11:50:34 +0300
commit95d002e0a34cb0f238abb39987f9980f325d8332 (patch)
treeb8ed70572a55b4e67410f906159f86e8aabb0f6a /tools/perf/scripts/python/sctop.py
parentd57b39e3ee3cdb4b00452090e386d197980cefc9 (diff)
parent28d618e9ab86f26a31af0b235ced55beb3e343c8 (diff)
downloadlinux-95d002e0a34cb0f238abb39987f9980f325d8332.tar.xz
Merge tag 'drm-intel-next-2019-04-04' into gvt-next
Merge back drm-intel-next for engine name definition refinement and 54939ea0bd85 ("drm/i915: Switch to use HWS indices rather than addresses") that would need gvt fixes to depend on. Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Diffstat (limited to 'tools/perf/scripts/python/sctop.py')
-rw-r--r--tools/perf/scripts/python/sctop.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/tools/perf/scripts/python/sctop.py b/tools/perf/scripts/python/sctop.py
index 61621b93affb..6e0278dcb092 100644
--- a/tools/perf/scripts/python/sctop.py
+++ b/tools/perf/scripts/python/sctop.py
@@ -8,7 +8,14 @@
# will be refreshed every [interval] seconds. The default interval is
# 3 seconds.
-import os, sys, thread, time
+from __future__ import print_function
+
+import os, sys, time
+
+try:
+ import thread
+except ImportError:
+ import _thread as thread
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
@@ -62,18 +69,20 @@ def print_syscall_totals(interval):
while 1:
clear_term()
if for_comm is not None:
- print "\nsyscall events for %s:\n\n" % (for_comm),
+ print("\nsyscall events for %s:\n" % (for_comm))
else:
- print "\nsyscall events:\n\n",
+ print("\nsyscall events:\n")
- print "%-40s %10s\n" % ("event", "count"),
- print "%-40s %10s\n" % ("----------------------------------------", \
- "----------"),
+ print("%-40s %10s" % ("event", "count"))
+ print("%-40s %10s" %
+ ("----------------------------------------",
+ "----------"))
- for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
- reverse = True):
+ for id, val in sorted(syscalls.items(),
+ key = lambda kv: (kv[1], kv[0]),
+ reverse = True):
try:
- print "%-40s %10d\n" % (syscall_name(id), val),
+ print("%-40s %10d" % (syscall_name(id), val))
except TypeError:
pass
syscalls.clear()