aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/check-perf-trace.py
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-04-11 08:36:30 -0400
committerTakashi Iwai <tiwai@suse.de>2019-04-11 08:36:30 -0400
commit9b0dcd0e5a27958b57e3e390f63c098d63a055da (patch)
treede778d683f121d3062df316994e9c4cf195eb12c /tools/perf/scripts/python/check-perf-trace.py
parentd7a181da2dfa3190487c446042ba01e07d851c74 (diff)
parentac71317e6be01812cc0c54d8be6d3c1139c8380b (diff)
Merge tag 'asoc-fix-v5.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.1 A few core fixes along with the driver specific ones, mainly fixing small issues that only affect x86 platforms for various reasons (their unusual machine enumeration mechanisms mainly, plus a fix for error handling in topology). There's some of the driver fixes that look larger than they are, like the hdmi-codec changes which resulted in an indentation change, and most of the other large changes are for new drivers like the STM32 changes.
Diffstat (limited to 'tools/perf/scripts/python/check-perf-trace.py')
-rw-r--r--tools/perf/scripts/python/check-perf-trace.py76
1 files changed, 39 insertions, 37 deletions
diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py
index 334599c6032c..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
10from __future__ import print_function
11
10import os 12import os
11import sys 13import sys
12 14
@@ -19,64 +21,64 @@ from perf_trace_context import *
19unhandled = autodict() 21unhandled = autodict()
20 22
21def trace_begin(): 23def trace_begin():
22 print "trace_begin" 24 print("trace_begin")
23 pass 25 pass
24 26
25def trace_end(): 27def trace_end():
26 print_unhandled() 28 print_unhandled()
27 29
28def irq__softirq_entry(event_name, context, common_cpu, 30def irq__softirq_entry(event_name, context, common_cpu,
29 common_secs, common_nsecs, common_pid, common_comm, 31 common_secs, common_nsecs, common_pid, common_comm,
30 common_callchain, vec): 32 common_callchain, vec):
31 print_header(event_name, common_cpu, common_secs, common_nsecs, 33 print_header(event_name, common_cpu, common_secs, common_nsecs,
32 common_pid, common_comm) 34 common_pid, common_comm)
33 35
34 print_uncommon(context) 36 print_uncommon(context)
35 37
36 print "vec=%s\n" % \ 38 print("vec=%s" % (symbol_str("irq__softirq_entry", "vec", vec)))
37 (symbol_str("irq__softirq_entry", "vec", vec)),
38 39
39def kmem__kmalloc(event_name, context, common_cpu, 40def kmem__kmalloc(event_name, context, common_cpu,
40 common_secs, common_nsecs, common_pid, common_comm, 41 common_secs, common_nsecs, common_pid, common_comm,
41 common_callchain, call_site, ptr, bytes_req, bytes_alloc, 42 common_callchain, call_site, ptr, bytes_req, bytes_alloc,
42 gfp_flags): 43 gfp_flags):
43 print_header(event_name, common_cpu, common_secs, common_nsecs, 44 print_header(event_name, common_cpu, common_secs, common_nsecs,
44 common_pid, common_comm) 45 common_pid, common_comm)
45 46
46 print_uncommon(context) 47 print_uncommon(context)
47 48
48 print "call_site=%u, ptr=%u, bytes_req=%u, " \ 49 print("call_site=%u, ptr=%u, bytes_req=%u, "
49 "bytes_alloc=%u, gfp_flags=%s\n" % \ 50 "bytes_alloc=%u, gfp_flags=%s" %
50 (call_site, ptr, bytes_req, bytes_alloc, 51 (call_site, ptr, bytes_req, bytes_alloc,
51 52 flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)))
52 flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)),
53 53
54def trace_unhandled(event_name, context, event_fields_dict): 54def trace_unhandled(event_name, context, event_fields_dict):
55 try: 55 try:
56 unhandled[event_name] += 1 56 unhandled[event_name] += 1
57 except TypeError: 57 except TypeError:
58 unhandled[event_name] = 1 58 unhandled[event_name] = 1
59 59
60def print_header(event_name, cpu, secs, nsecs, pid, comm): 60def print_header(event_name, cpu, secs, nsecs, pid, comm):
61 print "%-20s %5u %05u.%09u %8u %-20s " % \ 61 print("%-20s %5u %05u.%09u %8u %-20s " %
62 (event_name, cpu, secs, nsecs, pid, comm), 62 (event_name, cpu, secs, nsecs, pid, comm),
63 end=' ')
63 64
64# print trace fields not included in handler args 65# print trace fields not included in handler args
65def print_uncommon(context): 66def print_uncommon(context):
66 print "common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, " \ 67 print("common_preempt_count=%d, common_flags=%s, "
67 % (common_pc(context), trace_flag_str(common_flags(context)), \ 68 "common_lock_depth=%d, " %
68 common_lock_depth(context)) 69 (common_pc(context), trace_flag_str(common_flags(context)),
70 common_lock_depth(context)))
69 71
70def print_unhandled(): 72def print_unhandled():
71 keys = unhandled.keys() 73 keys = unhandled.keys()
72 if not keys: 74 if not keys:
73 return 75 return
74 76
75 print "\nunhandled events:\n\n", 77 print("\nunhandled events:\n")
76 78
77 print "%-40s %10s\n" % ("event", "count"), 79 print("%-40s %10s" % ("event", "count"))
78 print "%-40s %10s\n" % ("----------------------------------------", \ 80 print("%-40s %10s" % ("----------------------------------------",
79 "-----------"), 81 "-----------"))
80 82
81 for event_name in keys: 83 for event_name in keys:
82 print "%-40s %10d\n" % (event_name, unhandled[event_name]) 84 print("%-40s %10d\n" % (event_name, unhandled[event_name]))