History

perf scripts python: export-to-postgresql.py: Export comm details

Add table columns for thread id, comm start time and exec flag.

Adrian Hunter committed 7 years ago

Commit 8534b5d1 parent 41085f21 file · +10 −5Browse files

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

Unified · Split

tools/perf/scripts/python/export-to-postgresql.py+10−5
@@ -353,7 +353,10 @@ do_query(query, 'CREATE TABLE threads (' · 352 unmodified lines
353353 'tid integer)')
354354 do_query(query, 'CREATE TABLE comms ('
355355 '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)')
357360 do_query(query, 'CREATE TABLE comm_threads ('
358361 'id bigint NOT NULL,'
359362 'comm_id bigint,'
@@ -763,7 +766,7 @@ def trace_begin(): · 403 unmodified lines
763766 evsel_table(0, "unknown")
764767 machine_table(0, 0, "unknown")
765768 thread_table(0, 0, 0, -1, -1)
766− comm_table(0, "unknown")
769+ comm_table(0, "unknown", 0, 0, 0)
767770 dso_table(0, 0, "unknown", "unknown", "")
768771 symbol_table(0, 0, 0, 0, 0, "unknown")
769772 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(): · 81 unmodified lines
851854 do_query(query, 'ALTER TABLE threads '
852855 'ADD CONSTRAINT machinefk FOREIGN KEY (machine_id) REFERENCES machines (id),'
853856 '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)')
854859 do_query(query, 'ALTER TABLE comm_threads '
855860 'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),'
856861 '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): · 78 unmodified lines
935940 value = struct.pack("!hiqiqiqiiii", 5, 8, thread_id, 8, machine_id, 8, process_id, 4, pid, 4, tid)
936941 thread_file.write(value)
937942
938−def comm_table(comm_id, comm_str, *x):
943+def comm_table(comm_id, comm_str, thread_id, time, exec_flag, *x):
939944 comm_str = toserverstr(comm_str)
940945 n = len(comm_str)
941− fmt = "!hiqi" + str(n) + "s"
942− value = struct.pack(fmt, 2, 8, comm_id, n, comm_str)
946+ fmt = "!hiqi" + str(n) + "s" + "iqiqiB"
947+ value = struct.pack(fmt, 5, 8, comm_id, n, comm_str, 8, thread_id, 8, time, 1, exec_flag)
943948 comm_file.write(value)
944949
945950 def comm_thread_table(comm_thread_id, comm_id, thread_id, *x):

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t