<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/tools/perf/scripts/python/flamegraph.py, branch v6.18.21</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>perf flamegraph: Fix minor pylint/type hint issues</title>
<updated>2025-07-16T17:43:27+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2025-07-16T00:46:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=95d692f9aba7c13b5b3e8d842656c47bde7e551f'/>
<id>95d692f9aba7c13b5b3e8d842656c47bde7e551f</id>
<content type='text'>
Switch to assuming python3. Fix minor pylint issues on line length,
repeated compares, not using f-strings and variable case. Add type
hints and check with mypy.

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
Link: https://lore.kernel.org/r/20250716004635.31161-1-irogers@google.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Switch to assuming python3. Fix minor pylint issues on line length,
repeated compares, not using f-strings and variable case. Add type
hints and check with mypy.

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
Link: https://lore.kernel.org/r/20250716004635.31161-1-irogers@google.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf script: Add -e option to flamegraph script</title>
<updated>2025-06-24T17:27:51+00:00</updated>
<author>
<name>Tianyou Li</name>
<email>tianyou.li@intel.com</email>
</author>
<published>2025-06-10T04:04:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=9a79c50c2a95887859d5ac133180775b708b850a'/>
<id>9a79c50c2a95887859d5ac133180775b708b850a</id>
<content type='text'>
When processing the perf data file generated with multiple events,
the flamegraph script will count all the events regardless of
different event names.

This patch tries to add a -e option to specify the event name that
the flamegraph will be generated accordingly. If the -e option omitted,
the behavior remains unchanged.

Signed-off-by: Tianyou Li &lt;tianyou.li@intel.com&gt;
Reviewed-by: Pan Deng &lt;pan.deng@intel.com&gt;
Reviewed-by: Zhiguo Zhou &lt;zhiguo.zhou@intel.com&gt;
Reviewed-by: Wangyang Guo &lt;wangyang.guo@intel.com&gt;
Reviewed-by: Tim Chen &lt;tim.c.chen@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20250610040536.2390060-2-tianyou.li@intel.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When processing the perf data file generated with multiple events,
the flamegraph script will count all the events regardless of
different event names.

This patch tries to add a -e option to specify the event name that
the flamegraph will be generated accordingly. If the -e option omitted,
the behavior remains unchanged.

Signed-off-by: Tianyou Li &lt;tianyou.li@intel.com&gt;
Reviewed-by: Pan Deng &lt;pan.deng@intel.com&gt;
Reviewed-by: Zhiguo Zhou &lt;zhiguo.zhou@intel.com&gt;
Reviewed-by: Wangyang Guo &lt;wangyang.guo@intel.com&gt;
Reviewed-by: Tim Chen &lt;tim.c.chen@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20250610040536.2390060-2-tianyou.li@intel.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf script: Handle -i option for perf script flamegraph</title>
<updated>2025-06-24T17:27:50+00:00</updated>
<author>
<name>Tianyou Li</name>
<email>tianyou.li@intel.com</email>
</author>
<published>2025-06-10T04:04:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=df9c299371054cb725eef730fd0f1d0fe2ed6bb0'/>
<id>df9c299371054cb725eef730fd0f1d0fe2ed6bb0</id>
<content type='text'>
If specify the perf data file with -i option, the script will try to
read the header information regardless of the file name specified,
instead it will try to access the perf.data. This simple patch use the
file name from -i option for command perf report --header-only to read
the header.

Signed-off-by: Tianyou Li &lt;tianyou.li@intel.com&gt;
Reviewed-by: Pan Deng &lt;pan.deng@intel.com&gt;
Reviewed-by: Zhiguo Zhou &lt;zhiguo.zhou@intel.com&gt;
Reviewed-by: Wangyang Guo &lt;wangyang.guo@intel.com&gt;
Reviewed-by: Tim Chen &lt;tim.c.chen@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20250610040536.2390060-1-tianyou.li@intel.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If specify the perf data file with -i option, the script will try to
read the header information regardless of the file name specified,
instead it will try to access the perf.data. This simple patch use the
file name from -i option for command perf report --header-only to read
the header.

Signed-off-by: Tianyou Li &lt;tianyou.li@intel.com&gt;
Reviewed-by: Pan Deng &lt;pan.deng@intel.com&gt;
Reviewed-by: Zhiguo Zhou &lt;zhiguo.zhou@intel.com&gt;
Reviewed-by: Wangyang Guo &lt;wangyang.guo@intel.com&gt;
Reviewed-by: Tim Chen &lt;tim.c.chen@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20250610040536.2390060-1-tianyou.li@intel.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf script flamegraph: Avoid d3-flame-graph package dependency</title>
<updated>2023-01-19T12:29:58+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2023-01-18T07:24:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=b430d243673760ada58d3c8678ba9f11f72083cb'/>
<id>b430d243673760ada58d3c8678ba9f11f72083cb</id>
<content type='text'>
Currently flame graph generation requires a d3-flame-graph template to
be installed. Unfortunately this is hard to come by for things like
Debian [1].

If the template isn't installed then ask if it should be downloaded from
jsdelivr CDN. The downloaded HTML file is validated against an md5sum.
If the download fails, generate a minimal flame graph with the
javascript coming from links to jsdelivr CDN.

v3. Adds a warning message and quits before download in live mode.
v2. Change the warning to a prompt about downloading and add the
    --allow-download command line flag. Add an md5sum check for the
    downloaded HTML.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996839

Reviewed-by: Andreas Gerstmayr &lt;agerstmayr@redhat.com&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: 996839@bugs.debian.org
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Brendan Gregg &lt;brendan@intel.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Martin Spier &lt;spiermar@gmail.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20230118072409.147786-1-irogers@google.com # v3 discussion
Link: https://lore.kernel.org/r/20230112220024.32709-1-irogers@google.com # v2 discussion
Link: https://lore.kernel.org/r/CAP-5=fXi_9zdhTAoYApiFQoLURAvpEatFzU3uL23o3zs=z25ZQ@mail.gmail.com # v1 discussion
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently flame graph generation requires a d3-flame-graph template to
be installed. Unfortunately this is hard to come by for things like
Debian [1].

If the template isn't installed then ask if it should be downloaded from
jsdelivr CDN. The downloaded HTML file is validated against an md5sum.
If the download fails, generate a minimal flame graph with the
javascript coming from links to jsdelivr CDN.

v3. Adds a warning message and quits before download in live mode.
v2. Change the warning to a prompt about downloading and add the
    --allow-download command line flag. Add an md5sum check for the
    downloaded HTML.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996839

Reviewed-by: Andreas Gerstmayr &lt;agerstmayr@redhat.com&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: 996839@bugs.debian.org
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Brendan Gregg &lt;brendan@intel.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Martin Spier &lt;spiermar@gmail.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20230118072409.147786-1-irogers@google.com # v3 discussion
Link: https://lore.kernel.org/r/20230112220024.32709-1-irogers@google.com # v2 discussion
Link: https://lore.kernel.org/r/CAP-5=fXi_9zdhTAoYApiFQoLURAvpEatFzU3uL23o3zs=z25ZQ@mail.gmail.com # v1 discussion
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf flamegraph: flamegraph.py script improvements</title>
<updated>2021-08-30T21:22:23+00:00</updated>
<author>
<name>Andreas Gerstmayr</name>
<email>agerstmayr@redhat.com</email>
</author>
<published>2021-08-30T16:47:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=c611e4f24c79841f5637e62a8014f42da3dae5ae'/>
<id>c611e4f24c79841f5637e62a8014f42da3dae5ae</id>
<content type='text'>
* display perf.data header
* display PIDs of user stacks
* added option to change color scheme
* default to blue/green color scheme to improve accessibility
* correctly identify kernel stacks when kernel-debuginfo is installed

Signed-off-by: Andreas Gerstmayr &lt;agerstmayr@redhat.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lore.kernel.org/lkml/20210830164729.116049-1-agerstmayr@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* display perf.data header
* display PIDs of user stacks
* added option to change color scheme
* default to blue/green color scheme to improve accessibility
* correctly identify kernel stacks when kernel-debuginfo is installed

Signed-off-by: Andreas Gerstmayr &lt;agerstmayr@redhat.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lore.kernel.org/lkml/20210830164729.116049-1-agerstmayr@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf flamegraph: Explicitly set utf-8 encoding</title>
<updated>2020-06-22T16:30:55+00:00</updated>
<author>
<name>Andreas Gerstmayr</name>
<email>agerstmayr@redhat.com</email>
</author>
<published>2020-06-19T15:32:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=c42ad5d4358230be166fc36c87bae0dd1680c570'/>
<id>c42ad5d4358230be166fc36c87bae0dd1680c570</id>
<content type='text'>
On some platforms the default encoding is not utf-8, which causes an
UnicodeDecodeError when reading the flamegraph template and writing the
flamegraph

Signed-off-by: Andreas Gerstmayr &lt;agerstmayr@redhat.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Michael Petlan &lt;mpetlan@redhat.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lore.kernel.org/lkml/20200619153232.203537-1-agerstmayr@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On some platforms the default encoding is not utf-8, which causes an
UnicodeDecodeError when reading the flamegraph template and writing the
flamegraph

Signed-off-by: Andreas Gerstmayr &lt;agerstmayr@redhat.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Michael Petlan &lt;mpetlan@redhat.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lore.kernel.org/lkml/20200619153232.203537-1-agerstmayr@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf script: Add flamegraph.py script</title>
<updated>2020-04-16T15:19:14+00:00</updated>
<author>
<name>Andreas Gerstmayr</name>
<email>agerstmayr@redhat.com</email>
</author>
<published>2020-03-20T15:13:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=5287f926920688e1151741d49da37a533ccf1960'/>
<id>5287f926920688e1151741d49da37a533ccf1960</id>
<content type='text'>
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

Combined:

    perf script flamegraph -a -F 99 sleep 60

Committer testing:

Tested both with "PYTHON=python3" and with the default, that uses
python2-devel:

Complete set of instructions:

  $ mkdir /tmp/build/perf
  $ make PYTHON=python3 -C tools/perf O=/tmp/build/perf install-bin
  $ export PATH=~/bin:$PATH
  $ perf record -a -g -F 99 sleep 60
  $ perf script report flamegraph

Now go and open the generated flamegraph.html file in a browser.

At first this required building with PYTHON=python3, but after I
reported this Andreas was kind enough to send a patch making it work
with both python and python3.

Signed-off-by: Andreas Gerstmayr &lt;agerstmayr@redhat.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Brendan Gregg &lt;bgregg@netflix.com&gt;
Cc: Martin Spier &lt;mspier@netflix.com&gt;
Link: http://lore.kernel.org/lkml/20200320151355.66302-1-agerstmayr@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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

Combined:

    perf script flamegraph -a -F 99 sleep 60

Committer testing:

Tested both with "PYTHON=python3" and with the default, that uses
python2-devel:

Complete set of instructions:

  $ mkdir /tmp/build/perf
  $ make PYTHON=python3 -C tools/perf O=/tmp/build/perf install-bin
  $ export PATH=~/bin:$PATH
  $ perf record -a -g -F 99 sleep 60
  $ perf script report flamegraph

Now go and open the generated flamegraph.html file in a browser.

At first this required building with PYTHON=python3, but after I
reported this Andreas was kind enough to send a patch making it work
with both python and python3.

Signed-off-by: Andreas Gerstmayr &lt;agerstmayr@redhat.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Brendan Gregg &lt;bgregg@netflix.com&gt;
Cc: Martin Spier &lt;mspier@netflix.com&gt;
Link: http://lore.kernel.org/lkml/20200320151355.66302-1-agerstmayr@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
