Commit 761836cb authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf scripts python: export-to-sqlite.py: Export all sample flags

Add sample flags to the SQLite database definition and export.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lore.kernel.org/r/20220124084201.2699795-24-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c096fff6
...@@ -223,7 +223,8 @@ if branches: ...@@ -223,7 +223,8 @@ if branches:
'in_tx boolean,' 'in_tx boolean,'
'call_path_id bigint,' 'call_path_id bigint,'
'insn_count bigint,' 'insn_count bigint,'
'cyc_count bigint)') 'cyc_count bigint,'
'flags integer)')
else: else:
do_query(query, 'CREATE TABLE samples (' do_query(query, 'CREATE TABLE samples ('
'id integer NOT NULL PRIMARY KEY,' 'id integer NOT NULL PRIMARY KEY,'
...@@ -249,7 +250,8 @@ else: ...@@ -249,7 +250,8 @@ else:
'in_tx boolean,' 'in_tx boolean,'
'call_path_id bigint,' 'call_path_id bigint,'
'insn_count bigint,' 'insn_count bigint,'
'cyc_count bigint)') 'cyc_count bigint,'
'flags integer)')
if perf_db_export_calls or perf_db_export_callchains: if perf_db_export_calls or perf_db_export_callchains:
do_query(query, 'CREATE TABLE call_paths (' do_query(query, 'CREATE TABLE call_paths ('
...@@ -442,7 +444,8 @@ do_query(query, 'CREATE VIEW samples_view AS ' ...@@ -442,7 +444,8 @@ do_query(query, 'CREATE VIEW samples_view AS '
'in_tx,' 'in_tx,'
'insn_count,' 'insn_count,'
'cyc_count,' 'cyc_count,'
'CASE WHEN cyc_count=0 THEN CAST(0 AS FLOAT) ELSE ROUND(CAST(insn_count AS FLOAT) / cyc_count, 2) END AS IPC' 'CASE WHEN cyc_count=0 THEN CAST(0 AS FLOAT) ELSE ROUND(CAST(insn_count AS FLOAT) / cyc_count, 2) END AS IPC,'
'flags'
' FROM samples') ' FROM samples')
do_query(query, 'CREATE VIEW ptwrite_view AS ' do_query(query, 'CREATE VIEW ptwrite_view AS '
...@@ -584,9 +587,9 @@ branch_type_query = QSqlQuery(db) ...@@ -584,9 +587,9 @@ branch_type_query = QSqlQuery(db)
branch_type_query.prepare("INSERT INTO branch_types VALUES (?, ?)") branch_type_query.prepare("INSERT INTO branch_types VALUES (?, ?)")
sample_query = QSqlQuery(db) sample_query = QSqlQuery(db)
if branches: if branches:
sample_query.prepare("INSERT INTO samples VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") sample_query.prepare("INSERT INTO samples VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
else: else:
sample_query.prepare("INSERT INTO samples VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") sample_query.prepare("INSERT INTO samples VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
if perf_db_export_calls or perf_db_export_callchains: if perf_db_export_calls or perf_db_export_callchains:
call_path_query = QSqlQuery(db) call_path_query = QSqlQuery(db)
call_path_query.prepare("INSERT INTO call_paths VALUES (?, ?, ?, ?)") call_path_query.prepare("INSERT INTO call_paths VALUES (?, ?, ?, ?)")
...@@ -618,7 +621,7 @@ def trace_begin(): ...@@ -618,7 +621,7 @@ def trace_begin():
comm_table(0, "unknown", 0, 0, 0) comm_table(0, "unknown", 0, 0, 0)
dso_table(0, 0, "unknown", "unknown", "") dso_table(0, 0, "unknown", "unknown", "")
symbol_table(0, 0, 0, 0, 0, "unknown") symbol_table(0, 0, 0, 0, 0, "unknown")
sample_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) sample_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
if perf_db_export_calls or perf_db_export_callchains: if perf_db_export_calls or perf_db_export_callchains:
call_path_table(0, 0, 0, 0) call_path_table(0, 0, 0, 0)
call_return_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) call_return_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
...@@ -703,11 +706,11 @@ def sample_table(*x): ...@@ -703,11 +706,11 @@ def sample_table(*x):
if branches: if branches:
for xx in x[0:15]: for xx in x[0:15]:
sample_query.addBindValue(str(xx)) sample_query.addBindValue(str(xx))
for xx in x[19:24]: for xx in x[19:25]:
sample_query.addBindValue(str(xx)) sample_query.addBindValue(str(xx))
do_query_(sample_query) do_query_(sample_query)
else: else:
bind_exec(sample_query, 24, x) bind_exec(sample_query, 25, x)
def call_path_table(*x): def call_path_table(*x):
bind_exec(call_path_query, 4, x) bind_exec(call_path_query, 4, x)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment