diff options
Diffstat (limited to 'tools/perf/scripts/python')
| -rw-r--r-- | tools/perf/scripts/python/check-perf-trace.py | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py index f4838db3e518..d2c22954800d 100644 --- a/tools/perf/scripts/python/check-perf-trace.py +++ b/tools/perf/scripts/python/check-perf-trace.py | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | # events, etc. Basically, if this script runs successfully and | 7 | # events, etc. Basically, if this script runs successfully and |
| 8 | # displays expected results, Python scripting support should be ok. | 8 | # displays expected results, Python scripting support should be ok. |
| 9 | 9 | ||
| 10 | from __future__ import print_function | ||
| 11 | |||
| 10 | import os | 12 | import os |
| 11 | import sys | 13 | import sys |
| 12 | 14 | ||
| @@ -19,7 +21,7 @@ from perf_trace_context import * | |||
| 19 | unhandled = autodict() | 21 | unhandled = autodict() |
| 20 | 22 | ||
| 21 | def trace_begin(): | 23 | def trace_begin(): |
| 22 | print "trace_begin" | 24 | print("trace_begin") |
| 23 | pass | 25 | pass |
| 24 | 26 | ||
| 25 | def trace_end(): | 27 | def trace_end(): |
| @@ -33,7 +35,7 @@ def irq__softirq_entry(event_name, context, common_cpu, | |||
| 33 | 35 | ||
| 34 | print_uncommon(context) | 36 | print_uncommon(context) |
| 35 | 37 | ||
| 36 | print "vec=%s\n" % (symbol_str("irq__softirq_entry", "vec", vec)), | 38 | print("vec=%s" % (symbol_str("irq__softirq_entry", "vec", vec))) |
| 37 | 39 | ||
| 38 | def kmem__kmalloc(event_name, context, common_cpu, | 40 | def kmem__kmalloc(event_name, context, common_cpu, |
| 39 | common_secs, common_nsecs, common_pid, common_comm, | 41 | common_secs, common_nsecs, common_pid, common_comm, |
| @@ -44,10 +46,10 @@ def kmem__kmalloc(event_name, context, common_cpu, | |||
| 44 | 46 | ||
| 45 | print_uncommon(context) | 47 | print_uncommon(context) |
| 46 | 48 | ||
| 47 | print "call_site=%u, ptr=%u, bytes_req=%u, " \ | 49 | print("call_site=%u, ptr=%u, bytes_req=%u, " |
| 48 | "bytes_alloc=%u, gfp_flags=%s\n" % \ | 50 | "bytes_alloc=%u, gfp_flags=%s" % |
| 49 | (call_site, ptr, bytes_req, bytes_alloc, | 51 | (call_site, ptr, bytes_req, bytes_alloc, |
| 50 | flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)), | 52 | flag_str("kmem__kmalloc", "gfp_flags", gfp_flags))) |
| 51 | 53 | ||
| 52 | def trace_unhandled(event_name, context, event_fields_dict): | 54 | def trace_unhandled(event_name, context, event_fields_dict): |
| 53 | try: | 55 | try: |
| @@ -56,26 +58,27 @@ def trace_unhandled(event_name, context, event_fields_dict): | |||
| 56 | unhandled[event_name] = 1 | 58 | unhandled[event_name] = 1 |
| 57 | 59 | ||
| 58 | def print_header(event_name, cpu, secs, nsecs, pid, comm): | 60 | def print_header(event_name, cpu, secs, nsecs, pid, comm): |
| 59 | print "%-20s %5u %05u.%09u %8u %-20s " % \ | 61 | print("%-20s %5u %05u.%09u %8u %-20s " % |
| 60 | (event_name, cpu, secs, nsecs, pid, comm), | 62 | (event_name, cpu, secs, nsecs, pid, comm), |
| 63 | end=' ') | ||
| 61 | 64 | ||
| 62 | # print trace fields not included in handler args | 65 | # print trace fields not included in handler args |
| 63 | def print_uncommon(context): | 66 | def print_uncommon(context): |
| 64 | print "common_preempt_count=%d, common_flags=%s, " \ | 67 | print("common_preempt_count=%d, common_flags=%s, " |
| 65 | "common_lock_depth=%d, " % \ | 68 | "common_lock_depth=%d, " % |
| 66 | (common_pc(context), trace_flag_str(common_flags(context)), | 69 | (common_pc(context), trace_flag_str(common_flags(context)), |
| 67 | common_lock_depth(context)) | 70 | common_lock_depth(context))) |
| 68 | 71 | ||
| 69 | def print_unhandled(): | 72 | def print_unhandled(): |
| 70 | keys = unhandled.keys() | 73 | keys = unhandled.keys() |
| 71 | if not keys: | 74 | if not keys: |
| 72 | return | 75 | return |
| 73 | 76 | ||
| 74 | print "\nunhandled events:\n\n", | 77 | print("\nunhandled events:\n") |
| 75 | 78 | ||
| 76 | print "%-40s %10s\n" % ("event", "count"), | 79 | print("%-40s %10s" % ("event", "count")) |
| 77 | print "%-40s %10s\n" % ("----------------------------------------", \ | 80 | print("%-40s %10s" % ("----------------------------------------", |
| 78 | "-----------"), | 81 | "-----------")) |
| 79 | 82 | ||
| 80 | for event_name in keys: | 83 | for event_name in keys: |
| 81 | print "%-40s %10d\n" % (event_name, unhandled[event_name]) | 84 | print("%-40s %10d\n" % (event_name, unhandled[event_name])) |
