# 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 # 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 sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') 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]") ] parser = OptionParser(option_list=option_list) (opts, args) = parser.parse_args() if len(args) != 0: parser.error("unexpected command line argument") if opts.include_tid and not opts.include_comm: parser.error("requesting tid but not comm is invalid") if opts.include_pid and not opts.include_comm: parser.error("requesting pid but not comm is invalid") # event handlers lines = defaultdict(lambda: 0) def process_event(param_dict): def tidy_function_name(sym, dso): if sym is None: sym = '[unknown]' sym = sym.replace(';', ':') if opts.tidy_java: # the original stackcollapse-perf.pl script gives the # example of converting this: # Lorg/mozilla/javascript/MemberBox;.(Ljava/lang/reflect/Method;)V # to this: # org/mozilla/javascript/MemberBox:.init sym = sym.replace('<', '') sym = sym.replace('>', '') if sym[0] == 'L' and sym.find('/'): sym = sym[1:] try: sym = sym[:sym.index('(')] except ValueError: pass if opts.annotate_kernel and dso == '[kernel.kallsyms]': return sym + '_[k]' else: return sym stack = list() if 'callchain' in param_dict: for entry in param_dict['callchain']: entry.setdefault('sym', dict()) entry['sym'].setdefault('name', None) entry.setdefault('dso', None) stack.append(tidy_function_name(entry['sym']['name'], entry['dso'])) else: param_dict.setdefault('symbol', None) param_dict.setdefault('dso', None) stack.append(tidy_function_name(param_dict['symbol'], param_dict['dso'])) 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) stack_string = ';'.join(reversed(stack)) lines[stack_string] = lines[stack_string] + 1 def trace_end(): list = sorted(lines) for stack in list: print("%s %d" % (stack, lines[stack])) 'linux-4.6.y'>linux-4.6.y Hosts the 0x221E linux distro kernel.Ubuntu
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2013-07-22ASoC: omap-mcbsp: Support SND_SOC_DAIFMT_CBM_CFS for omap3/4Michael Trimarchi
2013-05-12ASoC: omap-mcbsp: Remove redundant platform_set_drvdata()Sachin Kamat
2013-04-12Merge remote-tracking branch 'asoc/topic/dma' into asoc-nextMark Brown
2013-04-03ASoC: omap: Use common DAI DMA dataLars-Peter Clausen
2013-03-26ASoC: switch over to use snd_soc_register_component() on omap mcbspKuninori Morimoto
2013-03-26ASoC: omap: Call omap_mcbsp_set_threshold() from mcbsp hw_paramsLars-Peter Clausen
2012-12-10ASoC: OMAP: remove __dev* attributesBill Pemberton
2012-11-27ASoC: OMAP: mcbsp fixes for enabling ARM multiplatform supportTony Lindgren
2012-10-09Merge tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/...Linus Torvalds
2012-09-22ASoC: OMAP: mcbsp, mcpdm, dmic, hdmi: Set dma_data at startup timePeter Ujfalusi
2012-09-22ASoC: OMAP: mcbsp, mcpdm, dmic: Let omap-pcm to pick the dma_typePeter Ujfalusi
2012-09-22ASoC: OMAP: Remove sync_mode from omap_pcm_dma_data structPeter Ujfalusi
2012-09-22ASoC: omap-mcbsp: Use sDMA packet mode instead of frame modePeter Ujfalusi
2012-09-19ARM: omap: move platform_data definitionsArnd Bergmann
2012-09-12ARM: OMAP2+: Prepare for irqs.h removalTony Lindgren
2012-08-25Merge branch 'asoc-omap' into for-3.7Mark Brown
2012-08-25ASoC: omap-mcbsp: Single macro for st channel volume set/getPeter Ujfalusi
2012-08-25ASoC: omap-mcbsp: Use macro to create the McBSP2/3 ST controlsPeter Ujfalusi
2012-08-25ASoC: omap-mcbsp: Only print warning if the st_data is missing for the portPeter Ujfalusi
2012-08-25ASoC: omap-mcbsp: Check mcbsp->id instead of cpu_dai->id when adding ST controlsPeter Ujfalusi
2012-08-22Merge branch 'asoc-omap' into for-3.7Mark Brown
2012-08-22ASoC: omap-mcbsp: Add device tree bindingsPeter Ujfalusi
2012-08-22ASoC: omap-mcbsp: Remove cpu_is_omap* checks from the codePeter Ujfalusi
2012-08-22ARM/ASoC: omap-mcbsp: Remove CLKR/FSR mux configuration codePeter Ujfalusi
2012-07-26ASoC: omap: Add missing modules aliases to get sound working on omap devicesGuillaume Gardet
2012-05-22ASoC: omap-mcbsp: buffer size constraint only applies to playback streamPeter Ujfalusi
2012-05-22ASoC: omap-mcbsp: Remove unused FRAME dma_op_modePeter Ujfalusi
2012-05-22ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+Peter Ujfalusi
2012-03-12ASoC: omap-mcbsp: fix snd_pcm_hw_rule_add argumentsGrazvydas Ignotas
2012-03-12ASoC: omap-mcbsp: Correct clock muxing for CLKR/FSR signalsPeter Ujfalusi
2012-03-12ASoC: omap-mcbsp: Single function CLKR/FSR source mux configurationPeter Ujfalusi
2012-03-12ASoC: omap-mcbsp: Simplify DMA configurationPeter Ujfalusi
2012-03-12ASoC: omap-mcbsp: Merge the omap_mcbsp_data into omap_mcbsp structurePeter Ujfalusi
2012-03-12ASoC: omap-mcbsp: Cleanup of module probe/remove codePeter Ujfalusi
2012-03-12ASoC: OMAP McBSP: Remove redundant accessorsPeter Ujfalusi
2012-03-12ASoC: omap-mcbsp: Create a single driver for McBSPPeter Ujfalusi
2012-03-12ASoC: OMAP: McBSP: Consolidate plat/mcbsp.h contentPeter Ujfalusi
2012-02-04ASoC: core: Add support for DAI and machine kcontrols.Liam Girdwood
2011-12-17ASoC: omap-mcbsp: Enable FIFO usage on OMAP4Peter Ujfalusi
2011-11-25ASoC: Convert omap directory to module_platform_driverAxel Lin
2011-11-23ASoC: Constify snd_soc_dai_ops structsLars-Peter Clausen
2011-10-10ASoC: fix checkpatch.pl error in omap-mcbspMichael Opdenacker
2011-10-02ASoC: omap-mcbsp: Prepare for init time DAI format settingJarkko Nikula
2011-09-30ASoC: omap-mcbsp: Fix FS polarity for LEFT_J, DSP_A and DSP_B formatsJarkko Nikula
2011-09-26ASoC: omap-mcbsp: Fix compile time warning about ambiguous ‘else’Peter Ujfalusi
2011-09-23ASoC: omap-mcbsp: Do not attempt to change DAI sysclk if stream is activeJarkko Nikula
2011-08-12ASoC: omap: Update e-mail address of Jarkko NikulaJarkko Nikula