~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/scripts/python/check-perf-trace.py

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/perf/scripts/python/check-perf-trace.py (Version linux-6.12-rc7) and /tools/perf/scripts/python/check-perf-trace.py (Version linux-4.19.323)


  1 # perf script event handlers, generated by per      1 # perf script event handlers, generated by perf script -g python
  2 # (c) 2010, Tom Zanussi <tzanussi@gmail.com>         2 # (c) 2010, Tom Zanussi <tzanussi@gmail.com>
  3 # Licensed under the terms of the GNU GPL Lice      3 # Licensed under the terms of the GNU GPL License version 2
  4 #                                                   4 #
  5 # This script tests basic functionality such a      5 # This script tests basic functionality such as flag and symbol
  6 # strings, common_xxx() calls back into perf,       6 # strings, common_xxx() calls back into perf, begin, end, unhandled
  7 # events, etc.  Basically, if this script runs      7 # events, etc.  Basically, if this script runs successfully and
  8 # displays expected results, Python scripting       8 # displays expected results, Python scripting support should be ok.
  9                                                     9 
 10 from __future__ import print_function          << 
 11                                                << 
 12 import os                                          10 import os
 13 import sys                                         11 import sys
 14                                                    12 
 15 sys.path.append(os.environ['PERF_EXEC_PATH'] +     13 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
 16         '/scripts/python/Perf-Trace-Util/lib/P     14         '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
 17                                                    15 
 18 from Core import *                                 16 from Core import *
 19 from perf_trace_context import *                   17 from perf_trace_context import *
 20                                                    18 
 21 unhandled = autodict()                             19 unhandled = autodict()
 22                                                    20 
 23 def trace_begin():                                 21 def trace_begin():
 24         print("trace_begin")                   !!  22         print "trace_begin"
 25         pass                                       23         pass
 26                                                    24 
 27 def trace_end():                                   25 def trace_end():
 28         print_unhandled()                      !!  26         print_unhandled()
 29                                                    27 
 30 def irq__softirq_entry(event_name, context, co     28 def irq__softirq_entry(event_name, context, common_cpu,
 31                        common_secs, common_nse !!  29         common_secs, common_nsecs, common_pid, common_comm,
 32                        common_callchain, vec): !!  30         common_callchain, vec):
 33         print_header(event_name, common_cpu, c !!  31                 print_header(event_name, common_cpu, common_secs, common_nsecs,
 34                 common_pid, common_comm)       !!  32                         common_pid, common_comm)
 35                                                    33 
 36         print_uncommon(context)                !!  34                 print_uncommon(context)
 37                                                    35 
 38         print("vec=%s" % (symbol_str("irq__sof !!  36                 print "vec=%s\n" % \
                                                   >>  37                 (symbol_str("irq__softirq_entry", "vec", vec)),
 39                                                    38 
 40 def kmem__kmalloc(event_name, context, common_     39 def kmem__kmalloc(event_name, context, common_cpu,
 41                   common_secs, common_nsecs, c !!  40         common_secs, common_nsecs, common_pid, common_comm,
 42                   common_callchain, call_site, !!  41         common_callchain, call_site, ptr, bytes_req, bytes_alloc,
 43                   gfp_flags):                  !!  42         gfp_flags):
 44         print_header(event_name, common_cpu, c !!  43                 print_header(event_name, common_cpu, common_secs, common_nsecs,
 45                 common_pid, common_comm)       !!  44                         common_pid, common_comm)
 46                                                    45 
 47         print_uncommon(context)                !!  46                 print_uncommon(context)
 48                                                    47 
 49         print("call_site=%u, ptr=%u, bytes_req !!  48                 print "call_site=%u, ptr=%u, bytes_req=%u, " \
 50                 "bytes_alloc=%u, gfp_flags=%s" !!  49                 "bytes_alloc=%u, gfp_flags=%s\n" % \
 51                 (call_site, ptr, bytes_req, by     50                 (call_site, ptr, bytes_req, bytes_alloc,
 52                 flag_str("kmem__kmalloc", "gfp !!  51 
                                                   >>  52                 flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)),
 53                                                    53 
 54 def trace_unhandled(event_name, context, event     54 def 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 
 60 def print_header(event_name, cpu, secs, nsecs,     60 def 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, !!  62         (event_name, cpu, secs, nsecs, pid, comm),
 63                 end=' ')                       << 
 64                                                    63 
 65 # print trace fields not included in handler a     64 # print trace fields not included in handler args
 66 def print_uncommon(context):                       65 def print_uncommon(context):
 67         print("common_preempt_count=%d, common !!  66     print "common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, " \
 68                 "common_lock_depth=%d, " %     !!  67         % (common_pc(context), trace_flag_str(common_flags(context)), \
 69                 (common_pc(context), trace_fla !!  68                common_lock_depth(context))
 70                 common_lock_depth(context)))   << 
 71                                                    69 
 72 def print_unhandled():                             70 def print_unhandled():
 73         keys = unhandled.keys()                !!  71     keys = unhandled.keys()
 74         if not keys:                           !!  72     if not keys:
 75                 return                         !!  73         return
 76                                                !!  74 
 77         print("\nunhandled events:\n")         !!  75     print "\nunhandled events:\n\n",
 78                                                !!  76 
 79         print("%-40s  %10s" % ("event", "count !!  77     print "%-40s  %10s\n" % ("event", "count"),
 80         print("%-40s  %10s" % ("-------------- !!  78     print "%-40s  %10s\n" % ("----------------------------------------", \
 81                                 "-----------") !!  79                                  "-----------"),
 82                                                    80 
 83         for event_name in keys:                !!  81     for event_name in keys:
 84                 print("%-40s  %10d\n" % (event !!  82         print "%-40s  %10d\n" % (event_name, unhandled[event_name])
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php