public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Petlan <mpetlan@redhat.com>
To: Anubhav Shelat <ashelat@redhat.com>
Cc: acme@kernel.org, namhyung@kernel.org, irogers@google.com,
	 linux-perf-users@vger.kernel.org, peterz@infradead.org,
	mingo@redhat.com,  mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	 adrian.hunter@intel.com, kan.liang@linux.intel.com,
	 dapeng1.mi@linux.intel.com, james.clark@linaro.org
Subject: Re: [PATCH] flamegraph: force flamegraph-report script to run in live mode when using 'perf script flamegraph'
Date: Fri, 31 Jan 2025 14:18:24 +0100 (CET)	[thread overview]
Message-ID: <14d94add-75cf-d6d8-3512-8341275e3597@redhat.com> (raw)
In-Reply-To: <20250130213526.2626749-1-ashelat@redhat.com>

On Thu, 30 Jan 2025, Anubhav Shelat wrote:
> Currently, running "perf script flamegraph -a -F 99 sleep 1" should
> produce flamegraph.html containing the flamegraph. Howevever, it gives a
> segmentation fault.
> 
> This is caused because the flamegraph.py script is
> supposed to take as input the output of "perf record", which should be
> in stdin. This would require passing "-i -" to flamegraph.py. However,
> the "flamegraph-report" script causes "perf script" command to take the
> "-i -" option instead of flamegraph.py, which causes no problem for
> "perf script", but causes a seg fault since flamegraph.py has no input
> file. To fix this I added the "-i -" option directly to the
> flamegraph-report script to ensure flamegraph.py gets input from stdin.
> 
> Signed-off-by: Anubhav Shelat <ashelat@redhat.com>

I'd suggest adjusting the title slightly, e.g.:
"perf script flamegraph: Force stdin in live mode"

Otherwise, thanks for the fix.

Tested-by: Michael Petlan <mpetlan@redhat.com>

> ---
>  tools/perf/scripts/python/bin/flamegraph-report | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/scripts/python/bin/flamegraph-report b/tools/perf/scripts/python/bin/flamegraph-report
> index 53c5dc90c87e..83d5738c75ca 100755
> --- a/tools/perf/scripts/python/bin/flamegraph-report
> +++ b/tools/perf/scripts/python/bin/flamegraph-report
> @@ -1,3 +1,3 @@
>  #!/bin/bash
>  # description: create flame graphs
> -perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -- "$@"
> +perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -i - -- "$@"
> -- 
> 2.48.1
> 
> 


      reply	other threads:[~2025-01-31 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30 21:35 [PATCH] flamegraph: force flamegraph-report script to run in live mode when using 'perf script flamegraph' Anubhav Shelat
2025-01-31 13:18 ` Michael Petlan [this message]

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=14d94add-75cf-d6d8-3512-8341275e3597@redhat.com \
    --to=mpetlan@redhat.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ashelat@redhat.com \
    --cc=dapeng1.mi@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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