<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/perf/scripts/python, branch v6.16</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.16</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.16'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-05-12T17:18:16Z</updated>
<entry>
<title>perf scripts python: exported-sql-viewer.py: Fix pattern matching with Python 3</title>
<updated>2025-05-12T17:18:16Z</updated>
<author>
<name>Adrian Hunter</name>
<email>adrian.hunter@intel.com</email>
</author>
<published>2025-05-12T09:39:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=17e548405a81665fd14cee960db7d093d1396400'/>
<id>urn:sha1:17e548405a81665fd14cee960db7d093d1396400</id>
<content type='text'>
The script allows the user to enter patterns to find symbols.

The pattern matching characters are converted for use in SQL.

For PostgreSQL the conversion involves using the Python maketrans()
method which is slightly different in Python 3 compared with Python 2.

Fix to work in Python 3.

Fixes: beda0e725e5f06ac ("perf script python: Add Python3 support to exported-sql-viewer.py")
Signed-off-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Ian Rogers &lt;irogers@google.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Tony Jones &lt;tonyj@suse.de&gt;
Link: https://lore.kernel.org/r/20250512093932.79854-4-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf script: Fix hangup in offline flamegraph report</title>
<updated>2025-02-19T00:12:19Z</updated>
<author>
<name>Namhyung Kim</name>
<email>namhyung@kernel.org</email>
</author>
<published>2025-02-19T00:05:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=29bab85418efd329c1a984fc9b885b6709481b27'/>
<id>urn:sha1:29bab85418efd329c1a984fc9b885b6709481b27</id>
<content type='text'>
A recent change in the flamegraph script fixed an issue with live mode
but it created another for offline mode.  It needs to pass "-" to -i
option to read from stdin in the live mode.  Actually there's a logic
to pass the option in the perf script code, but the script was written
with "-- $@" which prevented the option to go to the perf script.  So
the previous commit added the hard-coded "-i -" to the report command.

But it's a problem for the offline mode which expects input from a file
and now it's stuck on reading from stdin.  Let's remove the "-i - --"
part and let it pass the options properly to perf script.

Closes: https://lore.kernel.org/linux-perf-users/c41e4b04-e1fd-45ab-80b0-ec2ac6e94310@linux.ibm.com
Fixes: 23e0a63c6dd3f69c ("perf script: force stdin for flamegraph in live mode")
Reported-by: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Tested-by: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Cc: Anubhav Shelat &lt;ashelat@redhat.com&gt;
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf script: force stdin for flamegraph in live mode</title>
<updated>2025-02-04T03:49:10Z</updated>
<author>
<name>Anubhav Shelat</name>
<email>ashelat@redhat.com</email>
</author>
<published>2025-01-31T14:57:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=23e0a63c6dd3f69cb7ee18411e5f6857cca55b30'/>
<id>urn:sha1:23e0a63c6dd3f69cb7ee18411e5f6857cca55b30</id>
<content type='text'>
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 &lt;ashelat@redhat.com&gt;
Tested-by: Michael Petlan &lt;mpetlan@redhat.com&gt;
Link: https://lore.kernel.org/r/20250131145704.3164542-2-ashelat@redhat.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf script: Move script_fetch_insn to trace-event-scripting.c</title>
<updated>2024-12-18T19:24:32Z</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2024-11-19T01:16:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1ff2ca39b39f2ff5718a74bc4c92183b8eb9763f'/>
<id>urn:sha1:1ff2ca39b39f2ff5718a74bc4c92183b8eb9763f</id>
<content type='text'>
Add native_arch as a parameter to script_fetch_insn rather than
relying on the builtin-script value that won't be initialized for the
dlfilter and python Context use cases. Assume both of those cases are
running natively.

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Acked-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Cc: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Cc: Dapeng Mi &lt;dapeng1.mi@linux.intel.com&gt;
Cc: Howard Chu &lt;howardchu95@gmail.com&gt;
Cc: Ilya Leoshkevich &lt;iii@linux.ibm.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: James Clark &lt;james.clark@linaro.org&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.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;
Cc: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Cc: Veronika Molnarova &lt;vmolnaro@redhat.com&gt;
Cc: Weilin Wang &lt;weilin.wang@intel.com&gt;
Link: https://lore.kernel.org/r/20241119011644.971342-11-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf python: Remove python 2 scripting support</title>
<updated>2024-12-18T19:24:32Z</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2024-11-19T01:16:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e7e9943c87d857da650f228fdf6cb47b785b3ff9'/>
<id>urn:sha1:e7e9943c87d857da650f228fdf6cb47b785b3ff9</id>
<content type='text'>
Python2 was deprecated 4 years ago, remove support and workarounds.

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Acked-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Cc: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Cc: Dapeng Mi &lt;dapeng1.mi@linux.intel.com&gt;
Cc: Howard Chu &lt;howardchu95@gmail.com&gt;
Cc: Ilya Leoshkevich &lt;iii@linux.ibm.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: James Clark &lt;james.clark@linaro.org&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.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;
Cc: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Cc: Veronika Molnarova &lt;vmolnaro@redhat.com&gt;
Cc: Weilin Wang &lt;weilin.wang@intel.com&gt;
Link: https://lore.kernel.org/r/20241119011644.971342-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf script python: Improve physical mem type resolution</title>
<updated>2024-12-09T20:51:53Z</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2024-11-19T18:01:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d78e20c081e744812cba9d12933a0afe5bc09e61'/>
<id>urn:sha1:d78e20c081e744812cba9d12933a0afe5bc09e61</id>
<content type='text'>
Previously system RAM and persistent memory were hard code matched,
change so that the label of the memory region is just read from
/proc/iomem. This avoids frequent N/A samples.

Change the /proc/iomem reading, event processing and output so that
nested entries appear and their counts count toward their parent. As
labels may be repeated, include the memory ranges in the output to make
it clear why, for example, "System RAM" appears twice.

Before:

  Event: mem_inst_retired.all_loads:P
  Memory type                                    count  percentage
  ----------------------------------------  ----------  ----------
  System RAM                                      9460        96.5%
  N/A                                              998         3.5%

After:

  Event: mem_inst_retired.all_loads:P
  Memory type                                    count  percentage
  ----------------------------------------  ----------  ----------
  100000000-105f7fffff : System RAM              36741        96.5
    841400000-8416599ff : Kernel data               89         0.2
    840800000-8412a6fff : Kernel rodata             60         0.2
    841ebe000-8423fffff : Kernel bss                34         0.1
  0-fff : Reserved                                1345         3.5
  100000-89dd9fff : System RAM                       2         0.0

Before:

  Event: mem_inst_retired.any:P
  Memory type                                    count  percentage
  ----------------------------------------  -----------  -----------
  System RAM                                      9460        90.5%
  N/A                                              998         9.5%

After:

  Event: mem_inst_retired.any:P
  Memory type                                    count  percentage
  ----------------------------------------  ----------  ----------
  100000000-105f7fffff : System RAM               9460        90.5
    841400000-8416599ff : Kernel data               45         0.4
    840800000-8412a6fff : Kernel rodata             19         0.2
    841ebe000-8423fffff : Kernel bss                12         0.1
  0-fff : Reserved                                 998         9.5

The code has been updated to python 3 with type hints and resolving
issues reported by mypy and pylint. Tabs are swapped to spaces as
preferred in PEP8, because most lines of code were modified (of this
small file) and this makes pylint significantly less noisy.

Committer testing:

  root@number:/tmp# grep -m1 "model name" /proc/cpuinfo
  model name    : Intel(R) Core(TM) i7-14700K
  root@number:/tmp#
  root@number:/tmp# perf script mem-phys-addr -a find /
  /bin
  /lib
  /lib64
  /sbin
  Warning:
  744 out of order events recorded.
  Event: cpu_core/mem_inst_retired.all_loads/P
  Memory type                                    count  percentage
  ----------------------------------------  ----------  ----------
  100000000-8bfbfffff : System RAM              364561        76.5
    621400000-6223a6fff : Kernel rodata          10474         2.2
    622400000-62283d4bf : Kernel data             4828         1.0
    623304000-6237fffff : Kernel bss              1063         0.2
    620000000-6213fffff : Kernel code               98         0.0
  0-fff : Reserved                              111480        23.4
  100000-2b0ca017 : System RAM                     337         0.1
  2fbad000-30d92fff : System RAM                    44         0.0
  2c79d000-2fbabfff : System RAM                    30         0.0
  30d94000-316d5fff : System RAM                    16         0.0
  2b131a58-2c71dfff : System RAM                     7         0.0
  root@number:/tmp#

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Acked-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.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: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20241119180130.19160-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf script python: Adjust objdump start/end per map pgoff parameter</title>
<updated>2024-11-09T06:42:57Z</updated>
<author>
<name>Steve Clevenger</name>
<email>scclevenger@os.amperecomputing.com</email>
</author>
<published>2024-11-08T19:11:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e8328bf3cd135b5f443bed77f3791ac1633ae01e'/>
<id>urn:sha1:e8328bf3cd135b5f443bed77f3791ac1633ae01e</id>
<content type='text'>
Extract map_pgoff parameter from the dictionary, and adjust start/end
range passed to objdump based on the value.

A zero start_addr is filtered to prevent output of dso address range
check failures. This script repeatedly sees a zero value passed
in for
      start_addr = cpu_data[str(cpu) + 'addr']

These zero values are not a new problem. The start_addr/stop_addr warning
clutters the instruction trace output, hence this change.

Signed-off-by: Steve Clevenger &lt;scclevenger@os.amperecomputing.com&gt;
Reviewed-by: Leo Yan &lt;leo.yan@arm.com&gt;
Cc: suzuki.poulose@arm.com
Cc: james.clark@linaro.org
Cc: mike.leach@linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: coresight@lists.linaro.org
Cc: ilkka@os.amperecomputing.com
Link: https://lore.kernel.org/r/21ccdd22e664bdeccb878672d4b2c0518873c1e5.1731027120.git.scclevenger@os.amperecomputing.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf scripts python cs-etm: Add start and stop arguments</title>
<updated>2024-09-24T18:47:15Z</updated>
<author>
<name>James Clark</name>
<email>james.clark@linaro.org</email>
</author>
<published>2024-09-16T13:57:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=66dd3b539efe0d4b44324c1fe39978db8111ed93'/>
<id>urn:sha1:66dd3b539efe0d4b44324c1fe39978db8111ed93</id>
<content type='text'>
Make it possible to only disassemble a range of timestamps or sample
indexes. This will be used by the test to limit the runtime, but it's
also useful for users.

Reviewed-by: Leo Yan &lt;leo.yan@arm.com&gt;
Signed-off-by: James Clark &lt;james.clark@linaro.org&gt;
Tested-by: Ganapatrao Kulkarni &lt;gankulkarni@os.amperecomputing.com&gt;
Cc: Ben Gainey &lt;ben.gainey@arm.com&gt;
Cc: Suzuki K Poulose &lt;suzuki.poulose@arm.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Ruidong Tian &lt;tianruidong@linux.alibaba.com&gt;
Cc: Leo Yan &lt;leo.yan@linux.dev&gt;
Cc: Benjamin Gray &lt;bgray@linux.ibm.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Cc: coresight@lists.linaro.org
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: scclevenger@os.amperecomputing.com
Link: https://lore.kernel.org/r/20240916135743.1490403-7-james.clark@linaro.org
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf scripts python cs-etm: Improve arguments</title>
<updated>2024-09-24T18:47:11Z</updated>
<author>
<name>James Clark</name>
<email>james.clark@linaro.org</email>
</author>
<published>2024-09-16T13:57:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8286cc55a9a6f03d62bd140ce827025f9ed5e619'/>
<id>urn:sha1:8286cc55a9a6f03d62bd140ce827025f9ed5e619</id>
<content type='text'>
Make vmlinux detection automatic and use Perf's default objdump
when -d is specified. This will make it easier for a test to use the
script without having to provide arguments. And similarly for users.

Reviewed-by: Leo Yan &lt;leo.yan@arm.com&gt;
Signed-off-by: James Clark &lt;james.clark@linaro.org&gt;
Tested-by: Ganapatrao Kulkarni &lt;gankulkarni@os.amperecomputing.com&gt;
Cc: Ben Gainey &lt;ben.gainey@arm.com&gt;
Cc: Suzuki K Poulose &lt;suzuki.poulose@arm.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Ruidong Tian &lt;tianruidong@linux.alibaba.com&gt;
Cc: Leo Yan &lt;leo.yan@linux.dev&gt;
Cc: Benjamin Gray &lt;bgray@linux.ibm.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Cc: coresight@lists.linaro.org
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: scclevenger@os.amperecomputing.com
Link: https://lore.kernel.org/r/20240916135743.1490403-6-james.clark@linaro.org
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf scripts python cs-etm: Update to use argparse</title>
<updated>2024-09-24T18:47:07Z</updated>
<author>
<name>James Clark</name>
<email>james.clark@linaro.org</email>
</author>
<published>2024-09-16T13:57:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7b371afc9b67349c724c15d235924bc40694872a'/>
<id>urn:sha1:7b371afc9b67349c724c15d235924bc40694872a</id>
<content type='text'>
optparse is deprecated and less flexible than argparse so update it.

Reviewed-by: Leo Yan &lt;leo.yan@arm.com&gt;
Signed-off-by: James Clark &lt;james.clark@linaro.org&gt;
Tested-by: Ganapatrao Kulkarni &lt;gankulkarni@os.amperecomputing.com&gt;
Cc: Ben Gainey &lt;ben.gainey@arm.com&gt;
Cc: Suzuki K Poulose &lt;suzuki.poulose@arm.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Ruidong Tian &lt;tianruidong@linux.alibaba.com&gt;
Cc: Leo Yan &lt;leo.yan@linux.dev&gt;
Cc: Benjamin Gray &lt;bgray@linux.ibm.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Cc: coresight@lists.linaro.org
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: scclevenger@os.amperecomputing.com
Link: https://lore.kernel.org/r/20240916135743.1490403-5-james.clark@linaro.org
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
</feed>
