diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-01-13 01:06:28 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-01-13 01:06:28 -0500 |
commit | f43dc23d5ea91fca257be02138a255f02d98e806 (patch) | |
tree | b29722f6e965316e90ac97abf79923ced250dc21 /tools/perf/scripts/python/check-perf-trace.py | |
parent | f8e53553f452dcbf67cb89c8cba63a1cd6eb4cc0 (diff) | |
parent | 4162cf64973df51fc885825bc9ca4d055891c49f (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into common/serial-rework
Conflicts:
arch/sh/kernel/cpu/sh2/setup-sh7619.c
arch/sh/kernel/cpu/sh2a/setup-mxg.c
arch/sh/kernel/cpu/sh2a/setup-sh7201.c
arch/sh/kernel/cpu/sh2a/setup-sh7203.c
arch/sh/kernel/cpu/sh2a/setup-sh7206.c
arch/sh/kernel/cpu/sh3/setup-sh7705.c
arch/sh/kernel/cpu/sh3/setup-sh770x.c
arch/sh/kernel/cpu/sh3/setup-sh7710.c
arch/sh/kernel/cpu/sh3/setup-sh7720.c
arch/sh/kernel/cpu/sh4/setup-sh4-202.c
arch/sh/kernel/cpu/sh4/setup-sh7750.c
arch/sh/kernel/cpu/sh4/setup-sh7760.c
arch/sh/kernel/cpu/sh4a/setup-sh7343.c
arch/sh/kernel/cpu/sh4a/setup-sh7366.c
arch/sh/kernel/cpu/sh4a/setup-sh7722.c
arch/sh/kernel/cpu/sh4a/setup-sh7723.c
arch/sh/kernel/cpu/sh4a/setup-sh7724.c
arch/sh/kernel/cpu/sh4a/setup-sh7763.c
arch/sh/kernel/cpu/sh4a/setup-sh7770.c
arch/sh/kernel/cpu/sh4a/setup-sh7780.c
arch/sh/kernel/cpu/sh4a/setup-sh7785.c
arch/sh/kernel/cpu/sh4a/setup-sh7786.c
arch/sh/kernel/cpu/sh4a/setup-shx3.c
arch/sh/kernel/cpu/sh5/setup-sh5.c
drivers/serial/sh-sci.c
drivers/serial/sh-sci.h
include/linux/serial_sci.h
Diffstat (limited to 'tools/perf/scripts/python/check-perf-trace.py')
-rw-r--r-- | tools/perf/scripts/python/check-perf-trace.py | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py new file mode 100644 index 000000000000..4647a7694cf6 --- /dev/null +++ b/tools/perf/scripts/python/check-perf-trace.py | |||
@@ -0,0 +1,82 @@ | |||
1 | # perf script event handlers, generated by perf script -g python | ||
2 | # (c) 2010, Tom Zanussi <tzanussi@gmail.com> | ||
3 | # Licensed under the terms of the GNU GPL License version 2 | ||
4 | # | ||
5 | # This script tests basic functionality such as flag and symbol | ||
6 | # strings, common_xxx() calls back into perf, begin, end, unhandled | ||
7 | # events, etc. Basically, if this script runs successfully and | ||
8 | # displays expected results, Python scripting support should be ok. | ||
9 | |||
10 | import os | ||
11 | import sys | ||
12 | |||
13 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | ||
14 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') | ||
15 | |||
16 | from Core import * | ||
17 | from perf_trace_context import * | ||
18 | |||
19 | unhandled = autodict() | ||
20 | |||
21 | def trace_begin(): | ||
22 | print "trace_begin" | ||
23 | pass | ||
24 | |||
25 | def trace_end(): | ||
26 | print_unhandled() | ||
27 | |||
28 | def irq__softirq_entry(event_name, context, common_cpu, | ||
29 | common_secs, common_nsecs, common_pid, common_comm, | ||
30 | vec): | ||
31 | print_header(event_name, common_cpu, common_secs, common_nsecs, | ||
32 | common_pid, common_comm) | ||
33 | |||
34 | print_uncommon(context) | ||
35 | |||
36 | print "vec=%s\n" % \ | ||
37 | (symbol_str("irq__softirq_entry", "vec", vec)), | ||
38 | |||
39 | def kmem__kmalloc(event_name, context, common_cpu, | ||
40 | common_secs, common_nsecs, common_pid, common_comm, | ||
41 | call_site, ptr, bytes_req, bytes_alloc, | ||
42 | gfp_flags): | ||
43 | print_header(event_name, common_cpu, common_secs, common_nsecs, | ||
44 | common_pid, common_comm) | ||
45 | |||
46 | print_uncommon(context) | ||
47 | |||
48 | print "call_site=%u, ptr=%u, bytes_req=%u, " \ | ||
49 | "bytes_alloc=%u, gfp_flags=%s\n" % \ | ||
50 | (call_site, ptr, bytes_req, bytes_alloc, | ||
51 | |||
52 | flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)), | ||
53 | |||
54 | def trace_unhandled(event_name, context, event_fields_dict): | ||
55 | try: | ||
56 | unhandled[event_name] += 1 | ||
57 | except TypeError: | ||
58 | unhandled[event_name] = 1 | ||
59 | |||
60 | def print_header(event_name, cpu, secs, nsecs, pid, comm): | ||
61 | print "%-20s %5u %05u.%09u %8u %-20s " % \ | ||
62 | (event_name, cpu, secs, nsecs, pid, comm), | ||
63 | |||
64 | # print trace fields not included in handler args | ||
65 | def print_uncommon(context): | ||
66 | print "common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, " \ | ||
67 | % (common_pc(context), trace_flag_str(common_flags(context)), \ | ||
68 | common_lock_depth(context)) | ||
69 | |||
70 | def print_unhandled(): | ||
71 | keys = unhandled.keys() | ||
72 | if not keys: | ||
73 | return | ||
74 | |||
75 | print "\nunhandled events:\n\n", | ||
76 | |||
77 | print "%-40s %10s\n" % ("event", "count"), | ||
78 | print "%-40s %10s\n" % ("----------------------------------------", \ | ||
79 | "-----------"), | ||
80 | |||
81 | for event_name in keys: | ||
82 | print "%-40s %10d\n" % (event_name, unhandled[event_name]) | ||