linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, mingo@kernel.org,
	adrian.hunter@intel.com, hpa@zytor.com, tglx@linutronix.de,
	jolsa@redhat.com
Subject: [tip:perf/core] perf scripts python: export-to-postgresql.py: Add support for pyside2
Date: Thu, 30 May 2019 01:20:34 -0700	[thread overview]
Message-ID: <tip-3cd3216dbb421244b96b992f193e778a3baa2220@git.kernel.org> (raw)
In-Reply-To: <20190412113830.4126-6-adrian.hunter@intel.com>

Commit-ID:  3cd3216dbb421244b96b992f193e778a3baa2220
Gitweb:     https://git.kernel.org/tip/3cd3216dbb421244b96b992f193e778a3baa2220
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Fri, 12 Apr 2019 14:38:27 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 28 May 2019 18:37:45 -0300

perf scripts python: export-to-postgresql.py: Add support for pyside2

pyside2 is the future for pyside support.

Note pyside use Qt4 whereas pyside2 uses Qt5.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190412113830.4126-6-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/export-to-postgresql.py | 43 ++++++++++++++++++-----
 1 file changed, 34 insertions(+), 9 deletions(-)

diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py
index c3eae1d77d36..b2f481b0d28d 100644
--- a/tools/perf/scripts/python/export-to-postgresql.py
+++ b/tools/perf/scripts/python/export-to-postgresql.py
@@ -27,18 +27,31 @@ import datetime
 #
 # fedora:
 #
-#	$ sudo yum install postgresql postgresql-server python-pyside qt-postgresql
+#	$ sudo yum install postgresql postgresql-server qt-postgresql
 #	$ sudo su - postgres -c initdb
 #	$ sudo service postgresql start
 #	$ sudo su - postgres
-#	$ createuser <your user id here>
+#	$ createuser -s <your user id here>    # Older versions may not support -s, in which case answer the prompt below:
 #	Shall the new role be a superuser? (y/n) y
+#	$ sudo yum install python-pyside
+#
+#	Alternately, to use Python3 and/or pyside 2, one of the following:
+#		$ sudo yum install python3-pyside
+#		$ pip install --user PySide2
+#		$ pip3 install --user PySide2
 #
 # ubuntu:
 #
-#	$ sudo apt-get install postgresql python-pyside.qtsql libqt4-sql-psql
+#	$ sudo apt-get install postgresql
 #	$ sudo su - postgres
 #	$ createuser -s <your user id here>
+#	$ sudo apt-get install python-pyside.qtsql libqt4-sql-psql
+#
+#	Alternately, to use Python3 and/or pyside 2, one of the following:
+#
+#		$ sudo apt-get install python3-pyside.qtsql libqt4-sql-psql
+#		$ sudo apt-get install python-pyside2.qtsql libqt5sql5-psql
+#		$ sudo apt-get install python3-pyside2.qtsql libqt5sql5-psql
 #
 # An example of using this script with Intel PT:
 #
@@ -199,7 +212,16 @@ import datetime
 #                   print "{0:>6}  {1:>10}  {2:>9}  {3:<30}  {4:>6}  {5:<30}".format(query.value(0), query.value(1), query.value(2), query.value(3), query.value(4), query.value(5))
 #                   call_path_id = query.value(6)
 
-from PySide.QtSql import *
+pyside_version_1 = True
+if not "pyside-version-1" in sys.argv:
+	try:
+		from PySide2.QtSql import *
+		pyside_version_1 = False
+	except:
+		pass
+
+if pyside_version_1:
+	from PySide.QtSql import *
 
 if sys.version_info < (3, 0):
 	def toserverstr(str):
@@ -255,11 +277,12 @@ def printdate(*args, **kw_args):
         print(datetime.datetime.today(), *args, sep=' ', **kw_args)
 
 def usage():
-	printerr("Usage is: export-to-postgresql.py <database name> [<columns>] [<calls>] [<callchains>]")
-	printerr("where:	columns		'all' or 'branches'")
-	printerr("		calls		'calls' => create calls and call_paths table")
-	printerr("		callchains	'callchains' => create call_paths table")
-	raise Exception("Too few arguments")
+	printerr("Usage is: export-to-postgresql.py <database name> [<columns>] [<calls>] [<callchains>] [<pyside-version-1>]");
+	printerr("where:  columns            'all' or 'branches'");
+	printerr("        calls              'calls' => create calls and call_paths table");
+	printerr("        callchains         'callchains' => create call_paths table");
+	printerr("        pyside-version-1   'pyside-version-1' => use pyside version 1");
+	raise Exception("Too few or bad arguments")
 
 if (len(sys.argv) < 2):
 	usage()
@@ -281,6 +304,8 @@ for i in range(3,len(sys.argv)):
 		perf_db_export_calls = True
 	elif (sys.argv[i] == "callchains"):
 		perf_db_export_callchains = True
+	elif (sys.argv[i] == "pyside-version-1"):
+		pass
 	else:
 		usage()
 

  reply	other threads:[~2019-05-30  8:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 11:38 [PATCH 0/8] perf scripts python: Support pyside2 and misc Intel PT Adrian Hunter
2019-04-12 11:38 ` [PATCH 1/8] perf scripts python: exported-sql-viewer.py: Change python2 to python Adrian Hunter
2019-05-30  8:17   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 2/8] perf scripts python: exported-sql-viewer.py: Use argparse module for argument parsing Adrian Hunter
2019-05-30  8:18   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 3/8] perf scripts python: exported-sql-viewer.py: Add support for pyside2 Adrian Hunter
2019-05-30  8:19   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 4/8] perf scripts python: export-to-sqlite.py: " Adrian Hunter
2019-05-30  8:19   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 5/8] perf scripts python: export-to-postgresql.py: " Adrian Hunter
2019-05-30  8:20   ` tip-bot for Adrian Hunter [this message]
2019-04-12 11:38 ` [PATCH 6/8] perf tools: perf-with-kcore.sh: Always allow fix_buildid_cache_permissions Adrian Hunter
2019-05-30  7:52   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 7/8] perf intel-pt: Improve sync_switch Adrian Hunter
2019-05-30  8:21   ` [tip:perf/core] perf intel-pt: Improve sync_switch by processing PERF_RECORD_SWITCH* in events tip-bot for Adrian Hunter
2019-04-12 11:38 ` [PATCH 8/8] perf intel-pt: Rationalize intel_pt_sync_switch()'s use of next_tid Adrian Hunter
2019-05-30  8:21   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-04-29  7:28 ` [PATCH 0/8] perf scripts python: Support pyside2 and misc Intel PT Adrian Hunter
2019-05-20 14:39   ` Arnaldo Carvalho de Melo

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-3cd3216dbb421244b96b992f193e778a3baa2220@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).