From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jolsa@redhat.com, adrian.hunter@intel.com, tglx@linutronix.de,
mingo@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org,
hpa@zytor.com
Subject: [tip:perf/urgent] perf scripts python: export-to-postgresql.py: Export comm details
Date: Wed, 17 Jul 2019 15:57:39 -0700 [thread overview]
Message-ID: <tip-8534b5de81802a82b13fe05acc3e749e3baf980e@git.kernel.org> (raw)
In-Reply-To: <20190710085810.1650-11-adrian.hunter@intel.com>
Commit-ID: 8534b5de81802a82b13fe05acc3e749e3baf980e
Gitweb: https://git.kernel.org/tip/8534b5de81802a82b13fe05acc3e749e3baf980e
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Wed, 10 Jul 2019 11:57:59 +0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 10 Jul 2019 12:13:36 -0300
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>
---
tools/perf/scripts/python/export-to-postgresql.py | 15 ++++++++++-----
1 file 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 ('
'tid integer)')
do_query(query, 'CREATE TABLE comms ('
'id bigint NOT NULL,'
- 'comm varchar(16))')
+ 'comm varchar(16),'
+ 'c_thread_id bigint,'
+ 'c_time bigint,'
+ 'exec_flag boolean)')
do_query(query, 'CREATE TABLE comm_threads ('
'id bigint NOT NULL,'
'comm_id bigint,'
@@ -763,7 +766,7 @@ def trace_begin():
evsel_table(0, "unknown")
machine_table(0, 0, "unknown")
thread_table(0, 0, 0, -1, -1)
- comm_table(0, "unknown")
+ comm_table(0, "unknown", 0, 0, 0)
dso_table(0, 0, "unknown", "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)
@@ -851,6 +854,8 @@ def trace_end():
do_query(query, 'ALTER TABLE threads '
'ADD CONSTRAINT machinefk FOREIGN KEY (machine_id) REFERENCES machines (id),'
'ADD CONSTRAINT processfk FOREIGN KEY (process_id) REFERENCES threads (id)')
+ do_query(query, 'ALTER TABLE comms '
+ 'ADD CONSTRAINT threadfk FOREIGN KEY (c_thread_id) REFERENCES threads (id)')
do_query(query, 'ALTER TABLE comm_threads '
'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),'
'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):
value = struct.pack("!hiqiqiqiiii", 5, 8, thread_id, 8, machine_id, 8, process_id, 4, pid, 4, tid)
thread_file.write(value)
-def comm_table(comm_id, comm_str, *x):
+def comm_table(comm_id, comm_str, thread_id, time, exec_flag, *x):
comm_str = toserverstr(comm_str)
n = len(comm_str)
- fmt = "!hiqi" + str(n) + "s"
- value = struct.pack(fmt, 2, 8, comm_id, n, comm_str)
+ fmt = "!hiqi" + str(n) + "s" + "iqiqiB"
+ value = struct.pack(fmt, 5, 8, comm_id, n, comm_str, 8, thread_id, 8, time, 1, exec_flag)
comm_file.write(value)
def comm_thread_table(comm_thread_id, comm_id, thread_id, *x):
next prev parent reply other threads:[~2019-07-17 22:57 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 8:57 [PATCH 00/21] perf db-export: Comm tidy-up and export switch events Adrian Hunter
2019-07-10 8:57 ` [PATCH 01/21] perf db-export: Get rid of db_export__deferred() Adrian Hunter
2019-07-17 22:51 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:57 ` [PATCH 02/21] perf db-export: Rename db_export__comm() to db_export__exec_comm() Adrian Hunter
2019-07-17 22:52 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:57 ` [PATCH 03/21] perf db-export: Pass main_thread to db_export__thread() Adrian Hunter
2019-07-17 22:52 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:57 ` [PATCH 04/21] perf db-export: Export main_thread in db_export__sample() Adrian Hunter
2019-07-17 22:53 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:57 ` [PATCH 05/21] perf db-export: Export comm before exporting thread Adrian Hunter
2019-07-17 22:54 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:57 ` [PATCH 06/21] perf db-export: Move export__comm_thread into db_export__sample() Adrian Hunter
2019-07-17 22:54 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:57 ` [PATCH 07/21] perf db-export: Fix a white space issue in db_export__sample() Adrian Hunter
2019-07-17 22:55 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:57 ` [PATCH 08/21] perf db-export: Export comm details Adrian Hunter
2019-07-17 22:56 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:57 ` [PATCH 09/21] perf scripts python: export-to-sqlite.py: " Adrian Hunter
2019-07-17 22:56 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:57 ` [PATCH 10/21] perf scripts python: export-to-postgresql.py: " Adrian Hunter
2019-07-17 22:57 ` tip-bot for Adrian Hunter [this message]
2019-07-10 8:58 ` [PATCH 11/21] perf db-export: Factor out db_export__comm() Adrian Hunter
2019-07-17 22:58 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:58 ` [PATCH 12/21] perf db-export: Also export thread's current comm Adrian Hunter
2019-07-17 22:59 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:58 ` [PATCH 13/21] perf scripts python: export-to-sqlite.py: Add has_calls column to comms table Adrian Hunter
2019-07-17 22:59 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:58 ` [PATCH 14/21] perf scripts python: export-to-postgresql.py: " Adrian Hunter
2019-07-17 23:00 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:58 ` [PATCH 15/21] perf scripts python: exported-sql-viewer.py: Remove redundant semi-colons Adrian Hunter
2019-07-17 23:01 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:58 ` [PATCH 16/21] perf scripts python: exported-sql-viewer.py: Use new 'has_calls' column Adrian Hunter
2019-07-17 23:01 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:58 ` [PATCH 17/21] perf script: Add scripting operation process_switch() Adrian Hunter
2019-07-17 23:02 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:58 ` [PATCH 18/21] perf db-export: Factor out db_export__threads() Adrian Hunter
2019-07-17 23:03 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:58 ` [PATCH 19/21] perf db-export: Export switch events Adrian Hunter
2019-07-17 23:04 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:58 ` [PATCH 20/21] perf scripts python: export-to-sqlite.py: " Adrian Hunter
2019-07-17 23:04 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-10 8:58 ` [PATCH 21/21] perf scripts python: export-to-postgresql.py: " Adrian Hunter
2019-07-17 23:05 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-8534b5de81802a82b13fe05acc3e749e3baf980e@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).