diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2019-07-10 04:57:59 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-10 11:13:36 -0400 |
commit | 8534b5de81802a82b13fe05acc3e749e3baf980e (patch) | |
tree | 30d5a1039e43fd4b9accf5758bbbf4d391f08e13 /tools/perf/scripts/python | |
parent | 41085f2bdd5882632e7dd88d1e5b59b7eac2a2a9 (diff) |
perf scripts python: export-to-postgresql.py: Export comm details
Add table columns for thread id, comm start time and exec flag.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190710085810.1650-11-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python')
-rw-r--r-- | tools/perf/scripts/python/export-to-postgresql.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py index 92713d93e956..01f37877f5bb 100644 --- a/tools/perf/scripts/python/export-to-postgresql.py +++ b/tools/perf/scripts/python/export-to-postgresql.py | |||
@@ -353,7 +353,10 @@ do_query(query, 'CREATE TABLE threads (' | |||
353 | 'tid integer)') | 353 | 'tid integer)') |
354 | do_query(query, 'CREATE TABLE comms (' | 354 | do_query(query, 'CREATE TABLE comms (' |
355 | 'id bigint NOT NULL,' | 355 | 'id bigint NOT NULL,' |
356 | 'comm varchar(16))') | 356 | 'comm varchar(16),' |
357 | 'c_thread_id bigint,' | ||
358 | 'c_time bigint,' | ||
359 | 'exec_flag boolean)') | ||
357 | do_query(query, 'CREATE TABLE comm_threads (' | 360 | do_query(query, 'CREATE TABLE comm_threads (' |
358 | 'id bigint NOT NULL,' | 361 | 'id bigint NOT NULL,' |
359 | 'comm_id bigint,' | 362 | 'comm_id bigint,' |
@@ -763,7 +766,7 @@ def trace_begin(): | |||
763 | evsel_table(0, "unknown") | 766 | evsel_table(0, "unknown") |
764 | machine_table(0, 0, "unknown") | 767 | machine_table(0, 0, "unknown") |
765 | thread_table(0, 0, 0, -1, -1) | 768 | thread_table(0, 0, 0, -1, -1) |
766 | comm_table(0, "unknown") | 769 | comm_table(0, "unknown", 0, 0, 0) |
767 | dso_table(0, 0, "unknown", "unknown", "") | 770 | dso_table(0, 0, "unknown", "unknown", "") |
768 | symbol_table(0, 0, 0, 0, 0, "unknown") | 771 | symbol_table(0, 0, 0, 0, 0, "unknown") |
769 | 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) | 772 | 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) |
@@ -851,6 +854,8 @@ def trace_end(): | |||
851 | do_query(query, 'ALTER TABLE threads ' | 854 | do_query(query, 'ALTER TABLE threads ' |
852 | 'ADD CONSTRAINT machinefk FOREIGN KEY (machine_id) REFERENCES machines (id),' | 855 | 'ADD CONSTRAINT machinefk FOREIGN KEY (machine_id) REFERENCES machines (id),' |
853 | 'ADD CONSTRAINT processfk FOREIGN KEY (process_id) REFERENCES threads (id)') | 856 | 'ADD CONSTRAINT processfk FOREIGN KEY (process_id) REFERENCES threads (id)') |
857 | do_query(query, 'ALTER TABLE comms ' | ||
858 | 'ADD CONSTRAINT threadfk FOREIGN KEY (c_thread_id) REFERENCES threads (id)') | ||
854 | do_query(query, 'ALTER TABLE comm_threads ' | 859 | do_query(query, 'ALTER TABLE comm_threads ' |
855 | 'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),' | 860 | 'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),' |
856 | 'ADD CONSTRAINT threadfk FOREIGN KEY (thread_id) REFERENCES threads (id)') | 861 | 'ADD CONSTRAINT threadfk FOREIGN KEY (thread_id) REFERENCES threads (id)') |
@@ -935,11 +940,11 @@ def thread_table(thread_id, machine_id, process_id, pid, tid, *x): | |||
935 | value = struct.pack("!hiqiqiqiiii", 5, 8, thread_id, 8, machine_id, 8, process_id, 4, pid, 4, tid) | 940 | value = struct.pack("!hiqiqiqiiii", 5, 8, thread_id, 8, machine_id, 8, process_id, 4, pid, 4, tid) |
936 | thread_file.write(value) | 941 | thread_file.write(value) |
937 | 942 | ||
938 | def comm_table(comm_id, comm_str, *x): | 943 | def comm_table(comm_id, comm_str, thread_id, time, exec_flag, *x): |
939 | comm_str = toserverstr(comm_str) | 944 | comm_str = toserverstr(comm_str) |
940 | n = len(comm_str) | 945 | n = len(comm_str) |
941 | fmt = "!hiqi" + str(n) + "s" | 946 | fmt = "!hiqi" + str(n) + "s" + "iqiqiB" |
942 | value = struct.pack(fmt, 2, 8, comm_id, n, comm_str) | 947 | value = struct.pack(fmt, 5, 8, comm_id, n, comm_str, 8, thread_id, 8, time, 1, exec_flag) |
943 | comm_file.write(value) | 948 | comm_file.write(value) |
944 | 949 | ||
945 | def comm_thread_table(comm_thread_id, comm_id, thread_id, *x): | 950 | def comm_thread_table(comm_thread_id, comm_id, thread_id, *x): |