diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2019-04-12 07:38:25 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-05-28 17:37:45 -0400 |
commit | df8ea22a8fd9e4e8502f4fa917622801e1b4d09e (patch) | |
tree | 059d200f09cd284dc5d6228ca918b2227c8537e8 /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | 1ed7f47fd3af3c09d2cd64d1aff1c5b96d238111 (diff) |
perf scripts python: exported-sql-viewer.py: Add support for pyside2
pyside2 is the future for pyside support.
Note pyside use Qt4 whereas pyside2 uses Qt5.
Committer testing:
On a system with just:
# rpm -qa| grep -i pyside
python2-pyside-1.2.4-7.fc29.x86_64
#
Running:
$ python ~acme/libexec/perf-core/scripts/python/exported-sql-viewer.py ~/c/adrian.hunter/simple-retpoline.db &
[1] 7438
Makes it use the pyside 1 files:
$ grep -i pyside /proc/7438/maps | cut -d ' ' -f 6- | sort -u
/usr/lib64/libpyside-python2.7.so.1.2.4
/usr/lib64/python2.7/site-packages/PySide/QtCore.so
/usr/lib64/python2.7/site-packages/PySide/QtGui.so
/usr/lib64/python2.7/site-packages/PySide/QtSql.so
$ rpm -qf /usr/lib64/libpyside-python2.7.so.1.2.4
python2-pyside-1.2.4-7.fc29.x86_64
$
To get PySide2 I guess one needs to do:
$ pip install PySide2
But thats a 142MiB download I can't do right now, perhaps before pushing
upstream...
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190412113830.4126-4-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
-rwxr-xr-x | tools/perf/scripts/python/exported-sql-viewer.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py index 498b79454012..6fe553258ce5 100755 --- a/tools/perf/scripts/python/exported-sql-viewer.py +++ b/tools/perf/scripts/python/exported-sql-viewer.py | |||
@@ -105,10 +105,23 @@ except ImportError: | |||
105 | glb_nsz = 16 | 105 | glb_nsz = 16 |
106 | import re | 106 | import re |
107 | import os | 107 | import os |
108 | from PySide.QtCore import * | 108 | |
109 | from PySide.QtGui import * | ||
110 | from PySide.QtSql import * | ||
111 | pyside_version_1 = True | 109 | pyside_version_1 = True |
110 | if not "--pyside-version-1" in sys.argv: | ||
111 | try: | ||
112 | from PySide2.QtCore import * | ||
113 | from PySide2.QtGui import * | ||
114 | from PySide2.QtSql import * | ||
115 | from PySide2.QtWidgets import * | ||
116 | pyside_version_1 = False | ||
117 | except: | ||
118 | pass | ||
119 | |||
120 | if pyside_version_1: | ||
121 | from PySide.QtCore import * | ||
122 | from PySide.QtGui import * | ||
123 | from PySide.QtSql import * | ||
124 | |||
112 | from decimal import * | 125 | from decimal import * |
113 | from ctypes import * | 126 | from ctypes import * |
114 | from multiprocessing import Process, Array, Value, Event | 127 | from multiprocessing import Process, Array, Value, Event |
@@ -2755,7 +2768,7 @@ class WindowMenu(): | |||
2755 | action = self.window_menu.addAction(label) | 2768 | action = self.window_menu.addAction(label) |
2756 | action.setCheckable(True) | 2769 | action.setCheckable(True) |
2757 | action.setChecked(sub_window == self.mdi_area.activeSubWindow()) | 2770 | action.setChecked(sub_window == self.mdi_area.activeSubWindow()) |
2758 | action.triggered.connect(lambda x=nr: self.setActiveSubWindow(x)) | 2771 | action.triggered.connect(lambda a=None,x=nr: self.setActiveSubWindow(x)) |
2759 | self.window_menu.addAction(action) | 2772 | self.window_menu.addAction(action) |
2760 | nr += 1 | 2773 | nr += 1 |
2761 | 2774 | ||
@@ -3115,14 +3128,14 @@ class MainWindow(QMainWindow): | |||
3115 | event = event.split(":")[0] | 3128 | event = event.split(":")[0] |
3116 | if event == "branches": | 3129 | if event == "branches": |
3117 | label = "All branches" if branches_events == 1 else "All branches " + "(id=" + dbid + ")" | 3130 | label = "All branches" if branches_events == 1 else "All branches " + "(id=" + dbid + ")" |
3118 | reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda x=dbid: self.NewBranchView(x), self)) | 3131 | reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda a=None,x=dbid: self.NewBranchView(x), self)) |
3119 | label = "Selected branches" if branches_events == 1 else "Selected branches " + "(id=" + dbid + ")" | 3132 | label = "Selected branches" if branches_events == 1 else "Selected branches " + "(id=" + dbid + ")" |
3120 | reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda x=dbid: self.NewSelectedBranchView(x), self)) | 3133 | reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda a=None,x=dbid: self.NewSelectedBranchView(x), self)) |
3121 | 3134 | ||
3122 | def TableMenu(self, tables, menu): | 3135 | def TableMenu(self, tables, menu): |
3123 | table_menu = menu.addMenu("&Tables") | 3136 | table_menu = menu.addMenu("&Tables") |
3124 | for table in tables: | 3137 | for table in tables: |
3125 | table_menu.addAction(CreateAction(table, "Create a new window containing a table view", lambda t=table: self.NewTableView(t), self)) | 3138 | table_menu.addAction(CreateAction(table, "Create a new window containing a table view", lambda a=None,t=table: self.NewTableView(t), self)) |
3126 | 3139 | ||
3127 | def NewCallGraph(self): | 3140 | def NewCallGraph(self): |
3128 | CallGraphWindow(self.glb, self) | 3141 | CallGraphWindow(self.glb, self) |
@@ -3365,6 +3378,7 @@ def Main(): | |||
3365 | usage_str = "exported-sql-viewer.py [--pyside-version-1] <database name>\n" \ | 3378 | usage_str = "exported-sql-viewer.py [--pyside-version-1] <database name>\n" \ |
3366 | " or: exported-sql-viewer.py --help-only" | 3379 | " or: exported-sql-viewer.py --help-only" |
3367 | ap = argparse.ArgumentParser(usage = usage_str, add_help = False) | 3380 | ap = argparse.ArgumentParser(usage = usage_str, add_help = False) |
3381 | ap.add_argument("--pyside-version-1", action='store_true') | ||
3368 | ap.add_argument("dbname", nargs="?") | 3382 | ap.add_argument("dbname", nargs="?") |
3369 | ap.add_argument("--help-only", action='store_true') | 3383 | ap.add_argument("--help-only", action='store_true') |
3370 | args = ap.parse_args() | 3384 | args = ap.parse_args() |