Commit Graph
1 Commits
Author SHA1 Message Date
Ian Rogers 62d350135e perf python: Port export-to-sqlite to perf module
Port export-to-sqlite.py to a standalone script in tools/perf/python/
using the perf module and Python's standard library sqlite3 module.

Improvements compared to the legacy script:
- Remove the dependency on PySide/QtSql by using Python's built-in
  sqlite3 module in DatabaseExporter, allowing SQLite export on headless
  and minimal systems without Qt installed.
- Support Intel PT and hardware instruction trace export via
  perf.session(itrace=...) and perf.call_return callbacks, reconstructing
  relational call_paths and calls tables and decoding synthesized PT
  payloads (ptwrite, cbr, mwait, pwre, exstop, pwrx).
- Export context_switches via perf.session's context_switch callback
  and map thread and comm IDs to their relational database keys.
- Manage temporary staging files inside an isolated tempfile.mkdtemp()
  directory with guaranteed cleanup in a finally block.

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

Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2026-09-26 20:49:31 +02:00