Add sample flags to the PostgreSQL database definition and export.
Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all
Unified · Split
| @@ -399,7 +399,8 @@ if branches: · 398 unmodified lines | |||
| 399 | 'in_tx boolean,' | 399 | 'in_tx boolean,' |
| 400 | 'call_path_id bigint,' | 400 | 'call_path_id bigint,' |
| 401 | 'insn_count bigint,' | 401 | 'insn_count bigint,' |
| 402 | 'cyc_count bigint)') | 402 | 'cyc_count bigint,' |
| 403 | 'flags integer)') | ||
| 403 | else: | 404 | else: |
| 404 | do_query(query, 'CREATE TABLE samples (' | 405 | do_query(query, 'CREATE TABLE samples (' |
| 405 | 'id bigint NOT NULL,' | 406 | 'id bigint NOT NULL,' |
| @@ -425,7 +426,8 @@ else: · 19 unmodified lines | |||
| 425 | 'in_tx boolean,' | 426 | 'in_tx boolean,' |
| 426 | 'call_path_id bigint,' | 427 | 'call_path_id bigint,' |
| 427 | 'insn_count bigint,' | 428 | 'insn_count bigint,' |
| 428 | 'cyc_count bigint)') | 429 | 'cyc_count bigint,' |
| 430 | 'flags integer)') | ||
| 429 | 431 | ||
| 430 | if perf_db_export_calls or perf_db_export_callchains: | 432 | if perf_db_export_calls or perf_db_export_callchains: |
| 431 | do_query(query, 'CREATE TABLE call_paths (' | 433 | do_query(query, 'CREATE TABLE call_paths (' |
| @@ -604,7 +606,8 @@ do_query(query, 'CREATE VIEW samples_view AS ' · 172 unmodified lines | |||
| 604 | 'in_tx,' | 606 | 'in_tx,' |
| 605 | 'insn_count,' | 607 | 'insn_count,' |
| 606 | 'cyc_count,' | 608 | 'cyc_count,' |
| 607 | 'CASE WHEN cyc_count=0 THEN CAST(0 AS NUMERIC(20, 2)) ELSE CAST((CAST(insn_count AS FLOAT) / cyc_count) AS NUMERIC(20, 2)) END AS IPC' | 609 | 'CASE WHEN cyc_count=0 THEN CAST(0 AS NUMERIC(20, 2)) ELSE CAST((CAST(insn_count AS FLOAT) / cyc_count) AS NUMERIC(20, 2)) END AS IPC,' |
| 610 | 'flags' | ||
| 608 | ' FROM samples') | 611 | ' FROM samples') |
| 609 | 612 | ||
| 610 | do_query(query, 'CREATE VIEW ptwrite_view AS ' | 613 | do_query(query, 'CREATE VIEW ptwrite_view AS ' |
| @@ -804,7 +807,7 @@ def trace_begin(): · 193 unmodified lines | |||
| 804 | comm_table(0, "unknown", 0, 0, 0) | 807 | comm_table(0, "unknown", 0, 0, 0) |
| 805 | dso_table(0, 0, "unknown", "unknown", "") | 808 | dso_table(0, 0, "unknown", "unknown", "") |
| 806 | symbol_table(0, 0, 0, 0, 0, "unknown") | 809 | symbol_table(0, 0, 0, 0, 0, "unknown") |
| 807 | 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) | 810 | 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) |
| 808 | if perf_db_export_calls or perf_db_export_callchains: | 811 | if perf_db_export_calls or perf_db_export_callchains: |
| 809 | call_path_table(0, 0, 0, 0) | 812 | call_path_table(0, 0, 0, 0) |
| 810 | call_return_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | 813 | call_return_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) |
| @@ -1025,11 +1028,11 @@ def branch_type_table(branch_type, name, *x): · 214 unmodified lines | |||
| 1025 | value = struct.pack(fmt, 2, 4, branch_type, n, name) | 1028 | value = struct.pack(fmt, 2, 4, branch_type, n, name) |
| 1026 | branch_type_file.write(value) | 1029 | branch_type_file.write(value) |
| 1027 | 1030 | ||
| 1028 | def sample_table(sample_id, evsel_id, machine_id, thread_id, comm_id, dso_id, symbol_id, sym_offset, ip, time, cpu, to_dso_id, to_symbol_id, to_sym_offset, to_ip, period, weight, transaction, data_src, branch_type, in_tx, call_path_id, insn_cnt, cyc_cnt, *x): | 1031 | def sample_table(sample_id, evsel_id, machine_id, thread_id, comm_id, dso_id, symbol_id, sym_offset, ip, time, cpu, to_dso_id, to_symbol_id, to_sym_offset, to_ip, period, weight, transaction, data_src, branch_type, in_tx, call_path_id, insn_cnt, cyc_cnt, flags, *x): |
| 1029 | if branches: | 1032 | if branches: |
| 1030 | value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiiiBiqiqiq", 20, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 4, branch_type, 1, in_tx, 8, call_path_id, 8, insn_cnt, 8, cyc_cnt) | 1033 | value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiiiBiqiqiqii", 21, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 4, branch_type, 1, in_tx, 8, call_path_id, 8, insn_cnt, 8, cyc_cnt, 4, flags) |
| 1031 | else: | 1034 | else: |
| 1032 | value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiqiqiqiqiiiBiqiqiq", 24, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 8, period, 8, weight, 8, transaction, 8, data_src, 4, branch_type, 1, in_tx, 8, call_path_id, 8, insn_cnt, 8, cyc_cnt) | 1035 | value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiqiqiqiqiiiBiqiqiqii", 25, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 8, period, 8, weight, 8, transaction, 8, data_src, 4, branch_type, 1, in_tx, 8, call_path_id, 8, insn_cnt, 8, cyc_cnt, 4, flags) |
| 1033 | sample_file.write(value) | 1036 | sample_file.write(value) |
| 1034 | 1037 | ||
| 1035 | def call_path_table(cp_id, parent_id, symbol_id, ip, *x): | 1038 | def call_path_table(cp_id, parent_id, symbol_id, ip, *x): |