diff options
Diffstat (limited to 'tools/perf/scripts/python/futex-contention.py')
-rw-r--r-- | tools/perf/scripts/python/futex-contention.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/perf/scripts/python/futex-contention.py b/tools/perf/scripts/python/futex-contention.py index f221c62e0a10..0c4841acf75d 100644 --- a/tools/perf/scripts/python/futex-contention.py +++ b/tools/perf/scripts/python/futex-contention.py | |||
@@ -10,6 +10,8 @@ | |||
10 | # | 10 | # |
11 | # Measures futex contention | 11 | # Measures futex contention |
12 | 12 | ||
13 | from __future__ import print_function | ||
14 | |||
13 | import os, sys | 15 | import os, sys |
14 | sys.path.append(os.environ['PERF_EXEC_PATH'] + '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') | 16 | sys.path.append(os.environ['PERF_EXEC_PATH'] + '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') |
15 | from Util import * | 17 | from Util import * |
@@ -33,18 +35,18 @@ def syscalls__sys_enter_futex(event, ctxt, cpu, s, ns, tid, comm, callchain, | |||
33 | 35 | ||
34 | def syscalls__sys_exit_futex(event, ctxt, cpu, s, ns, tid, comm, callchain, | 36 | def syscalls__sys_exit_futex(event, ctxt, cpu, s, ns, tid, comm, callchain, |
35 | nr, ret): | 37 | nr, ret): |
36 | if thread_blocktime.has_key(tid): | 38 | if tid in thread_blocktime: |
37 | elapsed = nsecs(s, ns) - thread_blocktime[tid] | 39 | elapsed = nsecs(s, ns) - thread_blocktime[tid] |
38 | add_stats(lock_waits, (tid, thread_thislock[tid]), elapsed) | 40 | add_stats(lock_waits, (tid, thread_thislock[tid]), elapsed) |
39 | del thread_blocktime[tid] | 41 | del thread_blocktime[tid] |
40 | del thread_thislock[tid] | 42 | del thread_thislock[tid] |
41 | 43 | ||
42 | def trace_begin(): | 44 | def trace_begin(): |
43 | print "Press control+C to stop and show the summary" | 45 | print("Press control+C to stop and show the summary") |
44 | 46 | ||
45 | def trace_end(): | 47 | def trace_end(): |
46 | for (tid, lock) in lock_waits: | 48 | for (tid, lock) in lock_waits: |
47 | min, max, avg, count = lock_waits[tid, lock] | 49 | min, max, avg, count = lock_waits[tid, lock] |
48 | print "%s[%d] lock %x contended %d times, %d avg ns" % \ | 50 | print("%s[%d] lock %x contended %d times, %d avg ns" % |
49 | (process_names[tid], tid, lock, count, avg) | 51 | (process_names[tid], tid, lock, count, avg)) |
50 | 52 | ||