summaryrefslogtreecommitdiff
path: root/tools/perf/Documentation
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2026-09-25 23:20:10 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-09-26 20:49:31 +0200
commitb1f968c9656a8a874f566340ae501f888e700ad0 (patch)
treeb4bfc967e185265817e5df1cdb09be14b9ca1916 /tools/perf/Documentation
parent62d350135e676a11775bf7b85f1ed75a476d811c (diff)
downloadlinux-next-b1f968c9656a8a874f566340ae501f888e700ad0.tar.gz
linux-next-b1f968c9656a8a874f566340ae501f888e700ad0.zip
perf python: Port export-to-postgresql to perf module
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 <irogers@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/Documentation')
-rw-r--r--tools/perf/Documentation/db-export.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/Documentation/db-export.txt b/tools/perf/Documentation/db-export.txt
index b43f12b96973..20024e1f9164 100644
--- a/tools/perf/Documentation/db-export.txt
+++ b/tools/perf/Documentation/db-export.txt
@@ -8,7 +8,7 @@ perf tool's python scripting engine:
supports scripts:
tools/perf/python/export-to-sqlite.py
- tools/perf/scripts/python/export-to-postgresql.py
+ tools/perf/python/export-to-postgresql.py
which export data to a SQLite3 or PostgreSQL database.