<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/tools/perf/scripts/python, 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 scripts python: exported-sql-viewer.py: Fix pattern matching with Python 3</title>
<updated>2025-05-12T17:18:16+00:00</updated>
<author>
<name>Adrian Hunter</name>
<email>adrian.hunter@intel.com</email>
</author>
<published>2025-05-12T09:39:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=17e548405a81665fd14cee960db7d093d1396400'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf script: Fix hangup in offline flamegraph report</title>
<updated>2025-02-19T00:12:19+00:00</updated>
<author>
<name>Namhyung Kim</name>
<email>namhyung@kernel.org</email>
</author>
<published>2025-02-19T00:05:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=29bab85418efd329c1a984fc9b885b6709481b27'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf script: force stdin for flamegraph in live mode</title>
<updated>2025-02-04T03:49:10+00:00</updated>
<author>
<name>Anubhav Shelat</name>
<email>ashelat@redhat.com</email>
</author>
<published>2025-01-31T14:57:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=23e0a63c6dd3f69cb7ee18411e5f6857cca55b30'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf script: Move script_fetch_insn to trace-event-scripting.c</title>
<updated>2024-12-18T19:24:32+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2024-11-19T01:16:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=1ff2ca39b39f2ff5718a74bc4c92183b8eb9763f'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf python: Remove python 2 scripting support</title>
<updated>2024-12-18T19:24:32+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2024-11-19T01:16:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=e7e9943c87d857da650f228fdf6cb47b785b3ff9'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf script python: Improve physical mem type resolution</title>
<updated>2024-12-09T20:51:53+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2024-11-19T18:01:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=d78e20c081e744812cba9d12933a0afe5bc09e61'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf script python: Adjust objdump start/end per map pgoff parameter</title>
<updated>2024-11-09T06:42:57+00:00</updated>
<author>
<name>Steve Clevenger</name>
<email>scclevenger@os.amperecomputing.com</email>
</author>
<published>2024-11-08T19:11:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=e8328bf3cd135b5f443bed77f3791ac1633ae01e'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
</feed>
