# stackcollapse.py - format perf samples with one line per distinct call stack # SPDX-License-Identifier: GPL-2.0 # # This script's output has two space-separated fields. The first is a semicolon # separated stack including the program name (from the "comm" field) and the # function names from the call stack. The second is a count: # # swapper;start_kernel;rest_init;cpu_idle;default_idle;native_safe_halt 2 # # The file is sorted according to the first field. # # Input may be created and processed using: # # perf record -a -g -F 99 sleep 60 # perf script report stackcollapse > out.stacks-folded # # (perf script record stackcollapse works too). # # Written by Paolo Bonzini <pbonzini@redhat.com> # Based on Brendan Gregg's stackcollapse-perf.pl script.
from __future__ import print_function
import os import sys from collections import defaultdict from optparse import OptionParser, make_option
from perf_trace_context import * from Core import * from EventClass import *
# command line parsing
option_list = [ # formatting options for the bottom entry of the stack
make_option("--include-tid", dest="include_tid",
action="store_true", default=False,
help="include thread id in stack"),
make_option("--include-pid", dest="include_pid",
action="store_true", default=False,
help="include process id in stack"),
make_option("--no-comm", dest="include_comm",
action="store_false", default=True,
help="do not separate stacks according to comm"),
make_option("--tidy-java", dest="tidy_java",
action="store_true", default=False,
help="beautify Java signatures"),
make_option("--kernel", dest="annotate_kernel",
action="store_true", default=False,
help="annotate kernel functions with _[k]")
]
if len(args) != 0:
parser.error("unexpected command line argument") if opts.include_tid andnot opts.include_comm:
parser.error("requesting tid but not comm is invalid") if opts.include_pid andnot opts.include_comm:
parser.error("requesting pid but not comm is invalid")
if opts.include_comm:
comm = param_dict["comm"].replace(' ', '_')
sep = "-" if opts.include_pid:
comm = comm + sep + str(param_dict['sample']['pid'])
sep = "/" if opts.include_tid:
comm = comm + sep + str(param_dict['sample']['tid'])
stack.append(comm)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.