History

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

Add sample flags to the SQLite database definition and export.

Adrian Hunter committed 4 years ago

Commit 761836c1 parent c096fff1 file · +11 −8Browse files

Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all

Unified · Split

tools/perf/scripts/python/export-to-sqlite.py+11−8
@@ -223,7 +223,8 @@ if branches: · 222 unmodified lines
223223 'in_tx boolean,'
224224 'call_path_id bigint,'
225225 'insn_count bigint,'
226− 'cyc_count bigint)')
226+ 'cyc_count bigint,'
227+ 'flags integer)')
227228 else:
228229 do_query(query, 'CREATE TABLE samples ('
229230 'id integer NOT NULL PRIMARY KEY,'
@@ -249,7 +250,8 @@ else: · 19 unmodified lines
249250 'in_tx boolean,'
250251 'call_path_id bigint,'
251252 'insn_count bigint,'
252− 'cyc_count bigint)')
253+ 'cyc_count bigint,'
254+ 'flags integer)')
253255
254256 if perf_db_export_calls or perf_db_export_callchains:
255257 do_query(query, 'CREATE TABLE call_paths ('
@@ -442,7 +444,8 @@ do_query(query, 'CREATE VIEW samples_view AS ' · 186 unmodified lines
442444 'in_tx,'
443445 'insn_count,'
444446 'cyc_count,'
445− 'CASE WHEN cyc_count=0 THEN CAST(0 AS FLOAT) ELSE ROUND(CAST(insn_count AS FLOAT) / cyc_count, 2) END AS IPC'
447+ 'CASE WHEN cyc_count=0 THEN CAST(0 AS FLOAT) ELSE ROUND(CAST(insn_count AS FLOAT) / cyc_count, 2) END AS IPC,'
448+ 'flags'
446449 ' FROM samples')
447450
448451 do_query(query, 'CREATE VIEW ptwrite_view AS '
@@ -584,9 +587,9 @@ branch_type_query = QSqlQuery(db) · 135 unmodified lines
584587 branch_type_query.prepare("INSERT INTO branch_types VALUES (?, ?)")
585588 sample_query = QSqlQuery(db)
586589 if branches:
587− sample_query.prepare("INSERT INTO samples VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
590+ sample_query.prepare("INSERT INTO samples VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
588591 else:
589− sample_query.prepare("INSERT INTO samples VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
592+ sample_query.prepare("INSERT INTO samples VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
590593 if perf_db_export_calls or perf_db_export_callchains:
591594 call_path_query = QSqlQuery(db)
592595 call_path_query.prepare("INSERT INTO call_paths VALUES (?, ?, ?, ?)")
@@ -618,7 +621,7 @@ def trace_begin(): · 25 unmodified lines
618621 comm_table(0, "unknown", 0, 0, 0)
619622 dso_table(0, 0, "unknown", "unknown", "")
620623 symbol_table(0, 0, 0, 0, 0, "unknown")
621− 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)
624+ 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)
622625 if perf_db_export_calls or perf_db_export_callchains:
623626 call_path_table(0, 0, 0, 0)
624627 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): · 78 unmodified lines
703706 if branches:
704707 for xx in x[0:15]:
705708 sample_query.addBindValue(str(xx))
706− for xx in x[19:24]:
709+ for xx in x[19:25]:
707710 sample_query.addBindValue(str(xx))
708711 do_query_(sample_query)
709712 else:
710− bind_exec(sample_query, 24, x)
713+ bind_exec(sample_query, 25, x)
711714
712715 def call_path_table(*x):
713716 bind_exec(call_path_query, 4, x)