<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-next.git/tools/perf/python, branch master</title>
<subtitle>Linux kernel latest source</subtitle>
<id>http://mirrors.hust.edu.cn/git/linux-next.git/atom?h=master</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/linux-next.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/'/>
<updated>2026-10-03T09:41:36+00:00</updated>
<entry>
<title>perf timechart: Add an interactive --tui mode</title>
<updated>2026-10-03T09:41:36+00:00</updated>
<author>
<name>Alice Rogers</name>
<email>alice.mei.rogers@gmail.com</email>
</author>
<published>2026-10-02T18:26:19+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=e7a72d6919804e5e5a10e13d71e259acbc7510bc'/>
<id>urn:sha1:e7a72d6919804e5e5a10e13d71e259acbc7510bc</id>
<content type='text'>
Add ttimechart.py, a textual based interactive timechart, and a --tui
option to perf timechart that launches it through perf script. Rather
than writing an SVG file, per-CPU (busy, frequency and idle state),
per-task (running, runnable and blocked) and I/O timelines are shown in
the terminal along with a summary table. The timelines can be zoomed,
panned and the state of the selected row at the cursor is described,
including the task that woke it. The -i, -P, -T and -p options are
passed to the script.

The data is loaded in a background thread and the timelines are shown
and updated as it loads. A --dump option prints a text summary without
the UI.

Committer testing:

Fist record a short session with:

  root@x2:/home/acme/git/perf-tools-next# perf timechart record
  ^C[ perf record: Woken up 9 times to write data ]
  [ perf record: Captured and wrote 4.489 MB perf.data (29719 samples) ]
  root@x2:/home/acme/git/perf-tools-next#

Then try the TUI with:

  root@x2:/home/acme/git/perf-tools-next# tools/perf/python/ttimechart.py

or:

  root@x2:/home/acme/git/perf-tools-next# perf timechart --tui

Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Alice Rogers &lt;alice.mei.rogers@gmail.com&gt;
Co-developed-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf treport: Show the profile while it loads</title>
<updated>2026-10-03T09:23:21+00:00</updated>
<author>
<name>Alice Rogers</name>
<email>alice.mei.rogers@gmail.com</email>
</author>
<published>2026-10-02T18:26:17+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=b379b70b7b7b41ff3a8ec91f1506ee66dca80df4'/>
<id>urn:sha1:b379b70b7b7b41ff3a8ec91f1506ee66dca80df4</id>
<content type='text'>
Reading a large perf.data file caused a long stall before the treport
app started. Start the app immediately and build the profile in a
background thread, showing the report tree and flame graph as they are
built with the progress in the header. The time between updates grows
with the load time as updating the views costs more as the profile
grows. A lock guards the profile shared between the threads. Quitting
while loading cancels the load.

Tree nodes are now created lazily as they are expanded, expanded nodes
and the cursor are kept across updates, and events are kept in the order
they are first seen as their values aren't comparable. Node names are
escaped so they aren't interpreted as markup.

Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Alice Rogers &lt;alice.mei.rogers@gmail.com&gt;
Co-developed-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf python: Avoid shadowing exception name in PostgreSQL exporter</title>
<updated>2026-09-30T18:34:16+00:00</updated>
<author>
<name>Leo Yan</name>
<email>leo.yan@arm.com</email>
</author>
<published>2026-09-30T13:11:39+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=ccccf88a19322349612d631503af64592e263754'/>
<id>urn:sha1:ccccf88a19322349612d631503af64592e263754</id>
<content type='text'>
During the perf build, pylint reports:

  ************* Module export-to-postgresql
  python/export-to-postgresql.py:319:8: W0621: Redefining name 'e' from outer scope (line 100) (redefined-outer-name)

Rename 'e' to 'db_error' to clear the warning.

Fixes: b1f968c9656a8a87 ("perf python: Port export-to-postgresql to perf module")
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Assisted-by: Codex:gpt-6
Signed-off-by: Leo Yan &lt;leo.yan@arm.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf python event_analyzing_sample: Default to in-memory SQLite database</title>
<updated>2026-09-29T18:53:09+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2026-09-29T06:58:37+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=4b34e3ad4cbb91ff5d6f99bb9c7dd85694c15bec'/>
<id>urn:sha1:4b34e3ad4cbb91ff5d6f99bb9c7dd85694c15bec</id>
<content type='text'>
When -d/--db is not specified, event_analyzing_sample.py created a
temporary file in /tmp via tempfile.mkstemp() and deleted it in
trace_end(). As noted during review, creating the database in a shared
/tmp directory does not reserve SQLite's auxiliary sidecar filenames
(-journal or -wal), and a temporary on-disk file is unnecessary when the
caller did not ask to persist the database.

Default to sqlite3.connect(":memory:") when db_path is not provided,
removing the temporary file creation and cleanup logic, and test both
the default in-memory mode and explicit -d file mode in
test_event_analyzing_sample_python.sh.

Fixes: eeb70645a8097437 ("perf python: Port event_analyzing_sample to perf module")
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf python stat-cpi: Fix live mode signal races and test flakiness</title>
<updated>2026-09-29T18:51:23+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2026-09-29T06:58:33+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=2fc36cce77d8d94e4a17bc41ac9438bdb64ceb89'/>
<id>urn:sha1:2fc36cce77d8d94e4a17bc41ac9438bdb64ceb89</id>
<content type='text'>
In test_stat_cpi_python.sh, 'perf test -w noploop &amp;' defaults to a
1-second duration and can exit under heavy parallel load before
'perf stat -p' and 'perf script stat-cpi' finish starting up. In
addition, the fixed 'sleep 0.5' before sending SIGINT can fire before
Python finishes importing the perf module, opening the live evlist, and
flushing the first interval.

In stat-cpi.py, register SIGINT and SIGTERM handlers before calling
_open_live_evlist() and pass flush=True when printing live output so
redirected stdout is flushed immediately after each interval.

In test_stat_cpi_python.sh, run 'perf test -w noploop 60 &amp;' so the
target workload stays alive until killed, and poll the output file for
'cpi' (up to 5 seconds) before sending SIGINT.

Fixes: 4425182d426b ("perf python: Port stat-cpi to perf module")
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf python sctop: Fix offline interval printing and test flakiness</title>
<updated>2026-09-29T18:51:06+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2026-09-29T06:58:32+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=ac6e4e290bd8a0ae9c12c148b62f2be4b5d7a422'/>
<id>urn:sha1:ac6e4e290bd8a0ae9c12c148b62f2be4b5d7a422</id>
<content type='text'>
In sctop.py:
- If an earlier interval elapsed and printed an empty table before the
  target comm ('sleep') executed any syscalls, analyzer.printed became
  True and the final partial interval containing the target comm's
  syscalls was never flushed at EOF. Flush print_current_totals() in
  finally when analyzer.syscalls is non-empty as well as when nothing
  has been printed yet.
- Initialize analyzer.e_machine after creating perf.session rather than
  when session is still None.

In test_sctop_python.sh:
- Use a private temporary directory via 'mktemp -d'.
- Drop '-a' and pass '-B -N --no-bpf-event' to 'perf record', and sleep
  briefly in the subshell ('sh -c "sleep 0.1; sleep 0.05"') with a
  bounded retry loop so 'sleep's PERF_RECORD_COMM and sys_enter events
  are reliably captured under heavy load.

Fixes: b83f0bacf5e4f936 ("perf python: Port sctop to perf module")
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf python: Fix arm-cs-trace-disasm type error</title>
<updated>2026-09-28T16:30:01+00:00</updated>
<author>
<name>James Clark</name>
<email>james.clark@linaro.org</email>
</author>
<published>2026-09-28T12:58:09+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=da39380560de588b5e16efc334f62ecc6dd9af40'/>
<id>urn:sha1:da39380560de588b5e16efc334f62ecc6dd9af40</id>
<content type='text'>
The perf sample dso_bid getter returns a string or None, matching its
Optional[str] annotation. Attempting to decode it as bytes causes mypy
to report union-attr errors, even though this was behind a conditional
that checked for bytes type.

Use the string directly, retaining the fallback for an unknown build ID.

This fixes the following build error:

  python/arm-cs-trace-disasm.py:266: error: Item "None" of "str | None" has no attribute "decode"  [union-attr]

Fixes: 279b402e5143214c ("perf python: Port arm-cs-trace-disasm to perf module")
Reviewed-by: Leo Yan &lt;leo.yan@arm.com&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Assisted-by: Codex:GPT-6-Astra
Signed-off-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf python: Move and clean up parallel-perf.py</title>
<updated>2026-09-26T18:49:31+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2026-09-26T06:20:12+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=5084b5f91a70e0aa2811c7c894ac19424bfc4194'/>
<id>urn:sha1:5084b5f91a70e0aa2811c7c894ac19424bfc4194</id>
<content type='text'>
Move parallel-perf.py from tools/perf/scripts/python/ to
tools/perf/python/ as it is a standalone Python utility that invokes
'perf script' in parallel across time slices and CPUs. Update
tools/perf/tests/shell/script.sh accordingly.

Also fix bugs and clean up the script to pass mypy and pylint without
suppression comments:
- Fix Work.command() to return the shlex.quote()-escaped command string
  (previously sh_cmd was computed with shlex.quote() and discarded in
  favor of unquoted self.cmd).
- Close self.popen.stdout in the parent process after spawning the
  consumer subprocess in Work.start() when --pipe-to is used, ensuring
  the producer receives SIGPIPE if the consumer exits early and avoiding
  leaking the pipe file descriptor.
- Convert method and function names to snake_case, specify utf-8 file
  encodings, and add type annotations and docstrings.

Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf python: Move and clean up exported-sql-viewer.py</title>
<updated>2026-09-26T18:49:31+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2026-09-26T06:20:11+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=3df7d85a242fb93cfa63466b8fc9fc44aad19b92'/>
<id>urn:sha1:3df7d85a242fb93cfa63466b8fc9fc44aad19b92</id>
<content type='text'>
Move exported-sql-viewer.py from tools/perf/scripts/python/ to
tools/perf/python/ as it is a standalone PySide/PyQt GUI application
for viewing SQLite and PostgreSQL databases exported by perf script.

Improvements and cleanups compared to the legacy script:
- Add support for PySide6 (falling back to PySide2 and PySide) loaded
  dynamically via importlib, and provide stub base classes (_QtBase,
  _QtWidget) so static analysis (mypy and pylint) and --help-only
  execution succeed when Qt bindings are not installed.
- Fix a Python 3 NameError crash in HBoxLayout where expanded_mark and
  not_expanded_mark called Python 2's removed unicode() builtin instead
  of chr(0x25BC) and chr(0x25B6).
- Replace instance-level method monkey-patching
  (self.mousePressEvent = self.MousePressEvent) on SwitchGraphView with
  proper class methods gated by self.rb_enabled so Qt virtual method
  dispatch works cleanly across PySide2 and PySide6.
- Remove Python 2 constructs (cPickle, xrange), wildcard imports, bare
  'except:' clauses, and variable names shadowing Python builtins.

Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf python: Port export-to-postgresql to perf module</title>
<updated>2026-09-26T18:49:31+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2026-09-26T06:20:10+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=b1f968c9656a8a874f566340ae501f888e700ad0'/>
<id>urn:sha1:b1f968c9656a8a874f566340ae501f888e700ad0</id>
<content type='text'>
Port export-to-postgresql.py to a standalone script in
tools/perf/python/ using the perf module and libpq via ctypes.

Improvements compared to the legacy script:
- Remove the dependency on PySide/QtSql for database creation and DDL
  execution by driving libpq directly via ctypes (PQconnectdb, PQexec,
  PQputCopyData, PQputCopyEnd) and streaming binary PostgreSQL COPY
  files in PostgresExporter, enabling export on headless servers without
  Qt installed.
- Harden database connection and SQL identifier handling by rejecting
  URI ('://') and connection-parameter ('=') injection strings in
  setup_db() and connect(), escaping single quotes and backslashes in
  connection strings, and quoting SQL identifiers (quote_ident).
- Support Intel PT and instruction trace export via
  perf.session(itrace=...) and perf.call_return callbacks, reconstructing
  relational call_paths and calls tables (including id=0 placeholder
  rows and callfk/returnfk foreign keys) and unpacking synthesized PT
  payloads (ptwrite, cbr, mwait, pwre, exstop, pwrx).
- Use a dedicated context_switch ID counter so context-switch exports
  do not advance sample database IDs out of sync with call_return
  references.

Update Documentation/db-export.txt and add a shell test
(test_export_to_postgresql_python.sh) to verify the standalone exporter.

Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
</feed>
