Re: [PATCH] perf script: add flamegraph.py script

From: Kim Phillips
Date: Tue Mar 24 2020 - 12:16:49 EST


On 3/20/20 10:13 AM, Andreas Gerstmayr wrote:
> This script works in tandem with d3-flame-graph to generate flame graphs
> from perf. It supports two output formats: JSON and HTML (the default).
> The HTML format will look for a standalone d3-flame-graph template file in
> /usr/share/d3-flame-graph/d3-flamegraph-base.html and fill in the collected
> stacks.
>
> Usage:
>
> perf record -a -g -F 99 sleep 60
> perf script report flamegraph

On Ubuntu 19.10, where python 2.7 is still the default, I get:

$ perf script report flamegraph
File "/usr/libexec/perf-core/scripts/python/flamegraph.py", line 46
print(f"Flame Graph template {self.args.template} does not " +
^
SyntaxError: invalid syntax
Error running python script /usr/libexec/perf-core/scripts/python/flamegraph.py

Installing libpython3-dev doesn't help.

$ perf script -s lang

Scripting language extensions (used in perf script -s [spec:]script.[spec]):

Perl [Perl]
pl [Perl]
Python [Python]
py [Python]

Should there be a python3 in that list?

Thanks,

Kim