linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Brendan Gregg <bgregg@netflix.com>
Subject: Re: ping Re: [PATCH] perf script: Add stackcollapse.py script
Date: Thu, 16 Jun 2016 09:49:03 +0200	[thread overview]
Message-ID: <20160616074902.GA20561@krava> (raw)
In-Reply-To: <14a4eaa4-6b69-6c8e-6ae7-3a14ee7bb616@redhat.com>

On Fri, May 20, 2016 at 01:01:41PM +0200, Paolo Bonzini wrote:
> 
> 

SNIP

> >>> new file mode 100755
> >>> index 000000000000..356b9656393d
> >>> --- /dev/null
> >>> +++ b/tools/perf/scripts/python/bin/stackcollapse-report
> >>> @@ -0,0 +1,3 @@
> >>> +#!/bin/sh
> >>> +# description: produce callgraphs in short form for scripting use
> >>> +perf script -s "$PERF_EXEC_PATH"/scripts/python/stackcollapse.py -- "$@"
> >>> diff --git a/tools/perf/scripts/python/stackcollapse.py b/tools/perf/scripts/python/stackcollapse.py
> >>> new file mode 100755
> >>> index 000000000000..a2dfcda41ae6
> >>> --- /dev/null
> >>> +++ b/tools/perf/scripts/python/stackcollapse.py
> >>> @@ -0,0 +1,127 @@
> >>> +#!/usr/bin/perl -w
> >>> +#
> >>> +# stackcollapse.py - format perf samples with one line per distinct call stack
> >>> +#
> >>> +# 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).
> > 
> > IIRC Namhyung added -g folded option recently for report
> > so you could do:
> > 
> > perf report -g folded --stdio
> > 
> > however we dont seem to have it for perf script, so this might
> > be useful until we add the --call-graph support into perf script
> 
> While "perf report -g folded" is indeed similar in spirit, it doesn't
> provide exactly the same output as expected by the flame graph tools.
> The point of this patch is to talk directly to them, and to provide an
> example of looking at call stacks from Python.

as I said, while I rather see the --call-graph option support,
there's no harm in having this done by the script meanwhile

Acked-by: Jiri Olsa <jolsa@kernel.org>

jirka

  reply	other threads:[~2016-06-16  7:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 13:26 [PATCH] perf script: Add stackcollapse.py script Paolo Bonzini
2016-04-15  5:20 ` ping " Paolo Bonzini
2016-04-15 10:57   ` Jiri Olsa
2016-04-15 11:09     ` Paolo Bonzini
2016-05-20 11:01     ` Paolo Bonzini
2016-06-16  7:49       ` Jiri Olsa [this message]
2016-06-16  7:22 ` Paolo Bonzini
2016-06-16  7:49   ` Jiri Olsa
2016-06-16  9:26     ` Paolo Bonzini
2016-06-22  7:44 ` [tip:perf/core] " tip-bot for Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160616074902.GA20561@krava \
    --to=jolsa@redhat.com \
    --cc=acme@redhat.com \
    --cc=bgregg@netflix.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).