summaryrefslogtreecommitdiff
path: root/tools/perf/python/event_analyzing_sample.py
AgeCommit message (Collapse)Author
2026-09-29perf python event_analyzing_sample: Default to in-memory SQLite databaseIan Rogers
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 <irogers@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2026-09-26perf python: Port event_analyzing_sample to perf moduleIan Rogers
Port event_analyzing_sample.py to a standalone script in tools/perf/python/ using the perf module and standard library sqlite3 module. Improvements compared to the legacy script: - Encapsulate database state in a _DB container instead of mutating module-level globals, and ensure temporary SQLite database files are cleaned up on exit. - Add argparse CLI options (-i/--input and -d/--db) while preserving PerfEvent, PebsEvent, and PebsNHM binary raw_buf unpacking and symbol/DSO histogram reporting. - Remove Python 2 compatibility code and add type annotations. Add a shell test (test_event_analyzing_sample_python.sh) to verify the standalone script. Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Ian Rogers <irogers@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>