diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2019-04-12 07:38:26 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-05-28 17:37:45 -0400 |
commit | bfb3170e2481b76a4f8aae94176e45d681a37f3e (patch) | |
tree | fce4ff41bfcc2a121d5110e3575bc5427fd394c7 /tools/perf/scripts/python/export-to-sqlite.py | |
parent | df8ea22a8fd9e4e8502f4fa917622801e1b4d09e (diff) |
perf scripts python: export-to-sqlite.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-5-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
-rw-r--r-- | tools/perf/scripts/python/export-to-sqlite.py | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py index bf271fbc3a88..f617e518332f 100644 --- a/tools/perf/scripts/python/export-to-sqlite.py +++ b/tools/perf/scripts/python/export-to-sqlite.py | |||
@@ -21,6 +21,26 @@ import datetime | |||
21 | # provides LGPL-licensed Python bindings for Qt. You will also need the package | 21 | # provides LGPL-licensed Python bindings for Qt. You will also need the package |
22 | # libqt4-sql-sqlite for Qt sqlite3 support. | 22 | # libqt4-sql-sqlite for Qt sqlite3 support. |
23 | # | 23 | # |
24 | # Examples of installing pyside: | ||
25 | # | ||
26 | # ubuntu: | ||
27 | # | ||
28 | # $ sudo apt-get install python-pyside.qtsql libqt4-sql-psql | ||
29 | # | ||
30 | # Alternately, to use Python3 and/or pyside 2, one of the following: | ||
31 | # | ||
32 | # $ sudo apt-get install python3-pyside.qtsql libqt4-sql-psql | ||
33 | # $ sudo apt-get install python-pyside2.qtsql libqt5sql5-psql | ||
34 | # $ sudo apt-get install python3-pyside2.qtsql libqt5sql5-psql | ||
35 | # fedora: | ||
36 | # | ||
37 | # $ sudo yum install python-pyside | ||
38 | # | ||
39 | # Alternately, to use Python3 and/or pyside 2, one of the following: | ||
40 | # $ sudo yum install python3-pyside | ||
41 | # $ pip install --user PySide2 | ||
42 | # $ pip3 install --user PySide2 | ||
43 | # | ||
24 | # An example of using this script with Intel PT: | 44 | # An example of using this script with Intel PT: |
25 | # | 45 | # |
26 | # $ perf record -e intel_pt//u ls | 46 | # $ perf record -e intel_pt//u ls |
@@ -49,7 +69,16 @@ import datetime | |||
49 | # difference is the 'transaction' column of the 'samples' table which is | 69 | # difference is the 'transaction' column of the 'samples' table which is |
50 | # renamed 'transaction_' in sqlite because 'transaction' is a reserved word. | 70 | # renamed 'transaction_' in sqlite because 'transaction' is a reserved word. |
51 | 71 | ||
52 | from PySide.QtSql import * | 72 | pyside_version_1 = True |
73 | if not "pyside-version-1" in sys.argv: | ||
74 | try: | ||
75 | from PySide2.QtSql import * | ||
76 | pyside_version_1 = False | ||
77 | except: | ||
78 | pass | ||
79 | |||
80 | if pyside_version_1: | ||
81 | from PySide.QtSql import * | ||
53 | 82 | ||
54 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | 83 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ |
55 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') | 84 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') |
@@ -69,11 +98,12 @@ def printdate(*args, **kw_args): | |||
69 | print(datetime.datetime.today(), *args, sep=' ', **kw_args) | 98 | print(datetime.datetime.today(), *args, sep=' ', **kw_args) |
70 | 99 | ||
71 | def usage(): | 100 | def usage(): |
72 | printerr("Usage is: export-to-sqlite.py <database name> [<columns>] [<calls>] [<callchains>]"); | 101 | printerr("Usage is: export-to-sqlite.py <database name> [<columns>] [<calls>] [<callchains>] [<pyside-version-1>]"); |
73 | printerr("where: columns 'all' or 'branches'"); | 102 | printerr("where: columns 'all' or 'branches'"); |
74 | printerr(" calls 'calls' => create calls and call_paths table"); | 103 | printerr(" calls 'calls' => create calls and call_paths table"); |
75 | printerr(" callchains 'callchains' => create call_paths table"); | 104 | printerr(" callchains 'callchains' => create call_paths table"); |
76 | raise Exception("Too few arguments") | 105 | printerr(" pyside-version-1 'pyside-version-1' => use pyside version 1"); |
106 | raise Exception("Too few or bad arguments") | ||
77 | 107 | ||
78 | if (len(sys.argv) < 2): | 108 | if (len(sys.argv) < 2): |
79 | usage() | 109 | usage() |
@@ -95,6 +125,8 @@ for i in range(3,len(sys.argv)): | |||
95 | perf_db_export_calls = True | 125 | perf_db_export_calls = True |
96 | elif (sys.argv[i] == "callchains"): | 126 | elif (sys.argv[i] == "callchains"): |
97 | perf_db_export_callchains = True | 127 | perf_db_export_callchains = True |
128 | elif (sys.argv[i] == "pyside-version-1"): | ||
129 | pass | ||
98 | else: | 130 | else: |
99 | usage() | 131 | usage() |
100 | 132 | ||