0001 perf-script-python(1)
0002 ====================
0003
0004 NAME
0005 ----
0006 perf-script-python - Process trace data with a Python script
0007
0008 SYNOPSIS
0009 --------
0010 [verse]
0011 'perf script' [-s [Python]:script[.py] ]
0012
0013 DESCRIPTION
0014 -----------
0015
0016 This perf script option is used to process perf script data using perf's
0017 built-in Python interpreter. It reads and processes the input file and
0018 displays the results of the trace analysis implemented in the given
0019 Python script, if any.
0020
0021 A QUICK EXAMPLE
0022 ---------------
0023
0024 This section shows the process, start to finish, of creating a working
0025 Python script that aggregates and extracts useful information from a
0026 raw perf script stream. You can avoid reading the rest of this
0027 document if an example is enough for you; the rest of the document
0028 provides more details on each step and lists the library functions
0029 available to script writers.
0030
0031 This example actually details the steps that were used to create the
0032 'syscall-counts' script you see when you list the available perf script
0033 scripts via 'perf script -l'. As such, this script also shows how to
0034 integrate your script into the list of general-purpose 'perf script'
0035 scripts listed by that command.
0036
0037 The syscall-counts script is a simple script, but demonstrates all the
0038 basic ideas necessary to create a useful script. Here's an example
0039 of its output (syscall names are not yet supported, they will appear
0040 as numbers):
0041
0042 ----
0043 syscall events:
0044
0045 event count
0046 ---------------------------------------- -----------
0047 sys_write 455067
0048 sys_getdents 4072
0049 sys_close 3037
0050 sys_swapoff 1769
0051 sys_read 923
0052 sys_sched_setparam 826
0053 sys_open 331
0054 sys_newfstat 326
0055 sys_mmap 217
0056 sys_munmap 216
0057 sys_futex 141
0058 sys_select 102
0059 sys_poll 84
0060 sys_setitimer 12
0061 sys_writev 8
0062 15 8
0063 sys_lseek 7
0064 sys_rt_sigprocmask 6
0065 sys_wait4 3
0066 sys_ioctl 3
0067 sys_set_robust_list 1
0068 sys_exit 1
0069 56 1
0070 sys_access 1
0071 ----
0072
0073 Basically our task is to keep a per-syscall tally that gets updated
0074 every time a system call occurs in the system. Our script will do
0075 that, but first we need to record the data that will be processed by
0076 that script. Theoretically, there are a couple of ways we could do
0077 that:
0078
0079 - we could enable every event under the tracing/events/syscalls
0080 directory, but this is over 600 syscalls, well beyond the number
0081 allowable by perf. These individual syscall events will however be
0082 useful if we want to later use the guidance we get from the
0083 general-purpose scripts to drill down and get more detail about
0084 individual syscalls of interest.
0085
0086 - we can enable the sys_enter and/or sys_exit syscalls found under
0087 tracing/events/raw_syscalls. These are called for all syscalls; the
0088 'id' field can be used to distinguish between individual syscall
0089 numbers.
0090
0091 For this script, we only need to know that a syscall was entered; we
0092 don't care how it exited, so we'll use 'perf record' to record only
0093 the sys_enter events:
0094
0095 ----
0096 # perf record -a -e raw_syscalls:sys_enter
0097
0098 ^C[ perf record: Woken up 1 times to write data ]
0099 [ perf record: Captured and wrote 56.545 MB perf.data (~2470503 samples) ]
0100 ----
0101
0102 The options basically say to collect data for every syscall event
0103 system-wide and multiplex the per-cpu output into a single stream.
0104 That single stream will be recorded in a file in the current directory
0105 called perf.data.
0106
0107 Once we have a perf.data file containing our data, we can use the -g
0108 'perf script' option to generate a Python script that will contain a
0109 callback handler for each event type found in the perf.data trace
0110 stream (for more details, see the STARTER SCRIPTS section).
0111
0112 ----
0113 # perf script -g python
0114 generated Python script: perf-script.py
0115
0116 The output file created also in the current directory is named
0117 perf-script.py. Here's the file in its entirety:
0118
0119 # perf script event handlers, generated by perf script -g python
0120 # Licensed under the terms of the GNU GPL License version 2
0121
0122 # The common_* event handler fields are the most useful fields common to
0123 # all events. They don't necessarily correspond to the 'common_*' fields
0124 # in the format files. Those fields not available as handler params can
0125 # be retrieved using Python functions of the form common_*(context).
0126 # See the perf-script-python Documentation for the list of available functions.
0127
0128 import os
0129 import sys
0130
0131 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
0132 '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
0133
0134 from perf_trace_context import *
0135 from Core import *
0136
0137 def trace_begin():
0138 print "in trace_begin"
0139
0140 def trace_end():
0141 print "in trace_end"
0142
0143 def raw_syscalls__sys_enter(event_name, context, common_cpu,
0144 common_secs, common_nsecs, common_pid, common_comm,
0145 id, args):
0146 print_header(event_name, common_cpu, common_secs, common_nsecs,
0147 common_pid, common_comm)
0148
0149 print "id=%d, args=%s\n" % \
0150 (id, args),
0151
0152 def trace_unhandled(event_name, context, event_fields_dict):
0153 print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
0154
0155 def print_header(event_name, cpu, secs, nsecs, pid, comm):
0156 print "%-20s %5u %05u.%09u %8u %-20s " % \
0157 (event_name, cpu, secs, nsecs, pid, comm),
0158 ----
0159
0160 At the top is a comment block followed by some import statements and a
0161 path append which every perf script script should include.
0162
0163 Following that are a couple generated functions, trace_begin() and
0164 trace_end(), which are called at the beginning and the end of the
0165 script respectively (for more details, see the SCRIPT_LAYOUT section
0166 below).
0167
0168 Following those are the 'event handler' functions generated one for
0169 every event in the 'perf record' output. The handler functions take
0170 the form subsystem\__event_name, and contain named parameters, one for
0171 each field in the event; in this case, there's only one event,
0172 raw_syscalls__sys_enter(). (see the EVENT HANDLERS section below for
0173 more info on event handlers).
0174
0175 The final couple of functions are, like the begin and end functions,
0176 generated for every script. The first, trace_unhandled(), is called
0177 every time the script finds an event in the perf.data file that
0178 doesn't correspond to any event handler in the script. This could
0179 mean either that the record step recorded event types that it wasn't
0180 really interested in, or the script was run against a trace file that
0181 doesn't correspond to the script.
0182
0183 The script generated by -g option simply prints a line for each
0184 event found in the trace stream i.e. it basically just dumps the event
0185 and its parameter values to stdout. The print_header() function is
0186 simply a utility function used for that purpose. Let's rename the
0187 script and run it to see the default output:
0188
0189 ----
0190 # mv perf-script.py syscall-counts.py
0191 # perf script -s syscall-counts.py
0192
0193 raw_syscalls__sys_enter 1 00840.847582083 7506 perf id=1, args=
0194 raw_syscalls__sys_enter 1 00840.847595764 7506 perf id=1, args=
0195 raw_syscalls__sys_enter 1 00840.847620860 7506 perf id=1, args=
0196 raw_syscalls__sys_enter 1 00840.847710478 6533 npviewer.bin id=78, args=
0197 raw_syscalls__sys_enter 1 00840.847719204 6533 npviewer.bin id=142, args=
0198 raw_syscalls__sys_enter 1 00840.847755445 6533 npviewer.bin id=3, args=
0199 raw_syscalls__sys_enter 1 00840.847775601 6533 npviewer.bin id=3, args=
0200 raw_syscalls__sys_enter 1 00840.847781820 6533 npviewer.bin id=3, args=
0201 .
0202 .
0203 .
0204 ----
0205
0206 Of course, for this script, we're not interested in printing every
0207 trace event, but rather aggregating it in a useful way. So we'll get
0208 rid of everything to do with printing as well as the trace_begin() and
0209 trace_unhandled() functions, which we won't be using. That leaves us
0210 with this minimalistic skeleton:
0211
0212 ----
0213 import os
0214 import sys
0215
0216 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
0217 '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
0218
0219 from perf_trace_context import *
0220 from Core import *
0221
0222 def trace_end():
0223 print "in trace_end"
0224
0225 def raw_syscalls__sys_enter(event_name, context, common_cpu,
0226 common_secs, common_nsecs, common_pid, common_comm,
0227 id, args):
0228 ----
0229
0230 In trace_end(), we'll simply print the results, but first we need to
0231 generate some results to print. To do that we need to have our
0232 sys_enter() handler do the necessary tallying until all events have
0233 been counted. A hash table indexed by syscall id is a good way to
0234 store that information; every time the sys_enter() handler is called,
0235 we simply increment a count associated with that hash entry indexed by
0236 that syscall id:
0237
0238 ----
0239 syscalls = autodict()
0240
0241 try:
0242 syscalls[id] += 1
0243 except TypeError:
0244 syscalls[id] = 1
0245 ----
0246
0247 The syscalls 'autodict' object is a special kind of Python dictionary
0248 (implemented in Core.py) that implements Perl's 'autovivifying' hashes
0249 in Python i.e. with autovivifying hashes, you can assign nested hash
0250 values without having to go to the trouble of creating intermediate
0251 levels if they don't exist e.g syscalls[comm][pid][id] = 1 will create
0252 the intermediate hash levels and finally assign the value 1 to the
0253 hash entry for 'id' (because the value being assigned isn't a hash
0254 object itself, the initial value is assigned in the TypeError
0255 exception. Well, there may be a better way to do this in Python but
0256 that's what works for now).
0257
0258 Putting that code into the raw_syscalls__sys_enter() handler, we
0259 effectively end up with a single-level dictionary keyed on syscall id
0260 and having the counts we've tallied as values.
0261
0262 The print_syscall_totals() function iterates over the entries in the
0263 dictionary and displays a line for each entry containing the syscall
0264 name (the dictionary keys contain the syscall ids, which are passed to
0265 the Util function syscall_name(), which translates the raw syscall
0266 numbers to the corresponding syscall name strings). The output is
0267 displayed after all the events in the trace have been processed, by
0268 calling the print_syscall_totals() function from the trace_end()
0269 handler called at the end of script processing.
0270
0271 The final script producing the output shown above is shown in its
0272 entirety below (syscall_name() helper is not yet available, you can
0273 only deal with id's for now):
0274
0275 ----
0276 import os
0277 import sys
0278
0279 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
0280 '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
0281
0282 from perf_trace_context import *
0283 from Core import *
0284 from Util import *
0285
0286 syscalls = autodict()
0287
0288 def trace_end():
0289 print_syscall_totals()
0290
0291 def raw_syscalls__sys_enter(event_name, context, common_cpu,
0292 common_secs, common_nsecs, common_pid, common_comm,
0293 id, args):
0294 try:
0295 syscalls[id] += 1
0296 except TypeError:
0297 syscalls[id] = 1
0298
0299 def print_syscall_totals():
0300 if for_comm is not None:
0301 print "\nsyscall events for %s:\n\n" % (for_comm),
0302 else:
0303 print "\nsyscall events:\n\n",
0304
0305 print "%-40s %10s\n" % ("event", "count"),
0306 print "%-40s %10s\n" % ("----------------------------------------", \
0307 "-----------"),
0308
0309 for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
0310 reverse = True):
0311 print "%-40s %10d\n" % (syscall_name(id), val),
0312 ----
0313
0314 The script can be run just as before:
0315
0316 # perf script -s syscall-counts.py
0317
0318 So those are the essential steps in writing and running a script. The
0319 process can be generalized to any tracepoint or set of tracepoints
0320 you're interested in - basically find the tracepoint(s) you're
0321 interested in by looking at the list of available events shown by
0322 'perf list' and/or look in /sys/kernel/debug/tracing/events/ for
0323 detailed event and field info, record the corresponding trace data
0324 using 'perf record', passing it the list of interesting events,
0325 generate a skeleton script using 'perf script -g python' and modify the
0326 code to aggregate and display it for your particular needs.
0327
0328 After you've done that you may end up with a general-purpose script
0329 that you want to keep around and have available for future use. By
0330 writing a couple of very simple shell scripts and putting them in the
0331 right place, you can have your script listed alongside the other
0332 scripts listed by the 'perf script -l' command e.g.:
0333
0334 ----
0335 # perf script -l
0336 List of available trace scripts:
0337 wakeup-latency system-wide min/max/avg wakeup latency
0338 rw-by-file <comm> r/w activity for a program, by file
0339 rw-by-pid system-wide r/w activity
0340 ----
0341
0342 A nice side effect of doing this is that you also then capture the
0343 probably lengthy 'perf record' command needed to record the events for
0344 the script.
0345
0346 To have the script appear as a 'built-in' script, you write two simple
0347 scripts, one for recording and one for 'reporting'.
0348
0349 The 'record' script is a shell script with the same base name as your
0350 script, but with -record appended. The shell script should be put
0351 into the perf/scripts/python/bin directory in the kernel source tree.
0352 In that script, you write the 'perf record' command-line needed for
0353 your script:
0354
0355 ----
0356 # cat kernel-source/tools/perf/scripts/python/bin/syscall-counts-record
0357
0358 #!/bin/bash
0359 perf record -a -e raw_syscalls:sys_enter
0360 ----
0361
0362 The 'report' script is also a shell script with the same base name as
0363 your script, but with -report appended. It should also be located in
0364 the perf/scripts/python/bin directory. In that script, you write the
0365 'perf script -s' command-line needed for running your script:
0366
0367 ----
0368 # cat kernel-source/tools/perf/scripts/python/bin/syscall-counts-report
0369
0370 #!/bin/bash
0371 # description: system-wide syscall counts
0372 perf script -s ~/libexec/perf-core/scripts/python/syscall-counts.py
0373 ----
0374
0375 Note that the location of the Python script given in the shell script
0376 is in the libexec/perf-core/scripts/python directory - this is where
0377 the script will be copied by 'make install' when you install perf.
0378 For the installation to install your script there, your script needs
0379 to be located in the perf/scripts/python directory in the kernel
0380 source tree:
0381
0382 ----
0383 # ls -al kernel-source/tools/perf/scripts/python
0384 total 32
0385 drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 .
0386 drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 ..
0387 drwxr-xr-x 2 trz trz 4096 2010-01-26 22:29 bin
0388 -rw-r--r-- 1 trz trz 2548 2010-01-26 22:29 check-perf-script.py
0389 drwxr-xr-x 3 trz trz 4096 2010-01-26 22:49 Perf-Trace-Util
0390 -rw-r--r-- 1 trz trz 1462 2010-01-26 22:30 syscall-counts.py
0391 ----
0392
0393 Once you've done that (don't forget to do a new 'make install',
0394 otherwise your script won't show up at run-time), 'perf script -l'
0395 should show a new entry for your script:
0396
0397 ----
0398 # perf script -l
0399 List of available trace scripts:
0400 wakeup-latency system-wide min/max/avg wakeup latency
0401 rw-by-file <comm> r/w activity for a program, by file
0402 rw-by-pid system-wide r/w activity
0403 syscall-counts system-wide syscall counts
0404 ----
0405
0406 You can now perform the record step via 'perf script record':
0407
0408 # perf script record syscall-counts
0409
0410 and display the output using 'perf script report':
0411
0412 # perf script report syscall-counts
0413
0414 STARTER SCRIPTS
0415 ---------------
0416
0417 You can quickly get started writing a script for a particular set of
0418 trace data by generating a skeleton script using 'perf script -g
0419 python' in the same directory as an existing perf.data trace file.
0420 That will generate a starter script containing a handler for each of
0421 the event types in the trace file; it simply prints every available
0422 field for each event in the trace file.
0423
0424 You can also look at the existing scripts in
0425 ~/libexec/perf-core/scripts/python for typical examples showing how to
0426 do basic things like aggregate event data, print results, etc. Also,
0427 the check-perf-script.py script, while not interesting for its results,
0428 attempts to exercise all of the main scripting features.
0429
0430 EVENT HANDLERS
0431 --------------
0432
0433 When perf script is invoked using a trace script, a user-defined
0434 'handler function' is called for each event in the trace. If there's
0435 no handler function defined for a given event type, the event is
0436 ignored (or passed to a 'trace_unhandled' function, see below) and the
0437 next event is processed.
0438
0439 Most of the event's field values are passed as arguments to the
0440 handler function; some of the less common ones aren't - those are
0441 available as calls back into the perf executable (see below).
0442
0443 As an example, the following perf record command can be used to record
0444 all sched_wakeup events in the system:
0445
0446 # perf record -a -e sched:sched_wakeup
0447
0448 Traces meant to be processed using a script should be recorded with
0449 the above option: -a to enable system-wide collection.
0450
0451 The format file for the sched_wakeup event defines the following fields
0452 (see /sys/kernel/debug/tracing/events/sched/sched_wakeup/format):
0453
0454 ----
0455 format:
0456 field:unsigned short common_type;
0457 field:unsigned char common_flags;
0458 field:unsigned char common_preempt_count;
0459 field:int common_pid;
0460
0461 field:char comm[TASK_COMM_LEN];
0462 field:pid_t pid;
0463 field:int prio;
0464 field:int success;
0465 field:int target_cpu;
0466 ----
0467
0468 The handler function for this event would be defined as:
0469
0470 ----
0471 def sched__sched_wakeup(event_name, context, common_cpu, common_secs,
0472 common_nsecs, common_pid, common_comm,
0473 comm, pid, prio, success, target_cpu):
0474 pass
0475 ----
0476
0477 The handler function takes the form subsystem__event_name.
0478
0479 The common_* arguments in the handler's argument list are the set of
0480 arguments passed to all event handlers; some of the fields correspond
0481 to the common_* fields in the format file, but some are synthesized,
0482 and some of the common_* fields aren't common enough to to be passed
0483 to every event as arguments but are available as library functions.
0484
0485 Here's a brief description of each of the invariant event args:
0486
0487 event_name the name of the event as text
0488 context an opaque 'cookie' used in calls back into perf
0489 common_cpu the cpu the event occurred on
0490 common_secs the secs portion of the event timestamp
0491 common_nsecs the nsecs portion of the event timestamp
0492 common_pid the pid of the current task
0493 common_comm the name of the current process
0494
0495 All of the remaining fields in the event's format file have
0496 counterparts as handler function arguments of the same name, as can be
0497 seen in the example above.
0498
0499 The above provides the basics needed to directly access every field of
0500 every event in a trace, which covers 90% of what you need to know to
0501 write a useful trace script. The sections below cover the rest.
0502
0503 SCRIPT LAYOUT
0504 -------------
0505
0506 Every perf script Python script should start by setting up a Python
0507 module search path and 'import'ing a few support modules (see module
0508 descriptions below):
0509
0510 ----
0511 import os
0512 import sys
0513
0514 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
0515 '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
0516
0517 from perf_trace_context import *
0518 from Core import *
0519 ----
0520
0521 The rest of the script can contain handler functions and support
0522 functions in any order.
0523
0524 Aside from the event handler functions discussed above, every script
0525 can implement a set of optional functions:
0526
0527 *trace_begin*, if defined, is called before any event is processed and
0528 gives scripts a chance to do setup tasks:
0529
0530 ----
0531 def trace_begin():
0532 pass
0533 ----
0534
0535 *trace_end*, if defined, is called after all events have been
0536 processed and gives scripts a chance to do end-of-script tasks, such
0537 as display results:
0538
0539 ----
0540 def trace_end():
0541 pass
0542 ----
0543
0544 *trace_unhandled*, if defined, is called after for any event that
0545 doesn't have a handler explicitly defined for it. The standard set
0546 of common arguments are passed into it:
0547
0548 ----
0549 def trace_unhandled(event_name, context, event_fields_dict):
0550 pass
0551 ----
0552
0553 *process_event*, if defined, is called for any non-tracepoint event
0554
0555 ----
0556 def process_event(param_dict):
0557 pass
0558 ----
0559
0560 *context_switch*, if defined, is called for any context switch
0561
0562 ----
0563 def context_switch(ts, cpu, pid, tid, np_pid, np_tid, machine_pid, out, out_preempt, *x):
0564 pass
0565 ----
0566
0567 *auxtrace_error*, if defined, is called for any AUX area tracing error
0568
0569 ----
0570 def auxtrace_error(typ, code, cpu, pid, tid, ip, ts, msg, cpumode, *x):
0571 pass
0572 ----
0573
0574 The remaining sections provide descriptions of each of the available
0575 built-in perf script Python modules and their associated functions.
0576
0577 AVAILABLE MODULES AND FUNCTIONS
0578 -------------------------------
0579
0580 The following sections describe the functions and variables available
0581 via the various perf script Python modules. To use the functions and
0582 variables from the given module, add the corresponding 'from XXXX
0583 import' line to your perf script script.
0584
0585 Core.py Module
0586 ~~~~~~~~~~~~~~
0587
0588 These functions provide some essential functions to user scripts.
0589
0590 The *flag_str* and *symbol_str* functions provide human-readable
0591 strings for flag and symbolic fields. These correspond to the strings
0592 and values parsed from the 'print fmt' fields of the event format
0593 files:
0594
0595 flag_str(event_name, field_name, field_value) - returns the string representation corresponding to field_value for the flag field field_name of event event_name
0596 symbol_str(event_name, field_name, field_value) - returns the string representation corresponding to field_value for the symbolic field field_name of event event_name
0597
0598 The *autodict* function returns a special kind of Python
0599 dictionary that implements Perl's 'autovivifying' hashes in Python
0600 i.e. with autovivifying hashes, you can assign nested hash values
0601 without having to go to the trouble of creating intermediate levels if
0602 they don't exist.
0603
0604 autodict() - returns an autovivifying dictionary instance
0605
0606
0607 perf_trace_context Module
0608 ~~~~~~~~~~~~~~~~~~~~~~~~~
0609
0610 Some of the 'common' fields in the event format file aren't all that
0611 common, but need to be made accessible to user scripts nonetheless.
0612
0613 perf_trace_context defines a set of functions that can be used to
0614 access this data in the context of the current event. Each of these
0615 functions expects a context variable, which is the same as the
0616 context variable passed into every tracepoint event handler as the second
0617 argument. For non-tracepoint events, the context variable is also present
0618 as perf_trace_context.perf_script_context .
0619
0620 common_pc(context) - returns common_preempt count for the current event
0621 common_flags(context) - returns common_flags for the current event
0622 common_lock_depth(context) - returns common_lock_depth for the current event
0623 perf_sample_insn(context) - returns the machine code instruction
0624 perf_set_itrace_options(context, itrace_options) - set --itrace options if they have not been set already
0625 perf_sample_srcline(context) - returns source_file_name, line_number
0626 perf_sample_srccode(context) - returns source_file_name, line_number, source_line
0627
0628
0629 Util.py Module
0630 ~~~~~~~~~~~~~~
0631
0632 Various utility functions for use with perf script:
0633
0634 nsecs(secs, nsecs) - returns total nsecs given secs/nsecs pair
0635 nsecs_secs(nsecs) - returns whole secs portion given nsecs
0636 nsecs_nsecs(nsecs) - returns nsecs remainder given nsecs
0637 nsecs_str(nsecs) - returns printable string in the form secs.nsecs
0638 avg(total, n) - returns average given a sum and a total number of values
0639
0640 SUPPORTED FIELDS
0641 ----------------
0642
0643 Currently supported fields:
0644
0645 ev_name, comm, pid, tid, cpu, ip, time, period, phys_addr, addr,
0646 symbol, symoff, dso, time_enabled, time_running, values, callchain,
0647 brstack, brstacksym, datasrc, datasrc_decode, iregs, uregs,
0648 weight, transaction, raw_buf, attr, cpumode.
0649
0650 Fields that may also be present:
0651
0652 flags - sample flags
0653 flags_disp - sample flags display
0654 insn_cnt - instruction count for determining instructions-per-cycle (IPC)
0655 cyc_cnt - cycle count for determining IPC
0656 addr_correlates_sym - addr can correlate to a symbol
0657 addr_dso - addr dso
0658 addr_symbol - addr symbol
0659 addr_symoff - addr symbol offset
0660
0661 Some fields have sub items:
0662
0663 brstack:
0664 from, to, from_dsoname, to_dsoname, mispred,
0665 predicted, in_tx, abort, cycles.
0666
0667 brstacksym:
0668 items: from, to, pred, in_tx, abort (converted string)
0669
0670 For example,
0671 We can use this code to print brstack "from", "to", "cycles".
0672
0673 if 'brstack' in dict:
0674 for entry in dict['brstack']:
0675 print "from %s, to %s, cycles %s" % (entry["from"], entry["to"], entry["cycles"])
0676
0677 SEE ALSO
0678 --------
0679 linkperf:perf-script[1]