diff options
| author | Ingo Molnar <mingo@kernel.org> | 2019-05-30 03:47:57 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2019-05-30 03:47:57 -0400 |
| commit | b33fb3cf6f5e039dea4a85a708a2c86f8a323575 (patch) | |
| tree | 50daac162069c464a67b6509a2b92c88649b7210 /tools/perf/scripts/python/exported-sql-viewer.py | |
| parent | 849e96f30068d4f6f8352715e02a10533a46deba (diff) | |
| parent | 14f1cfd4f7b4794e2f9d2ae214bcf049654b0b5c (diff) | |
Merge tag 'perf-core-for-mingo-5.3-20190529' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
BPF:
Jiri Olsa:
- Preserve eBPF maps when loading kcore.
- Fix up DSO name padding in 'perf script --call-trace', as BPF DSO names are
much larger than what we used to have there.
- Add --show-bpf-events to 'perf script'.
perf trace:
Arnaldo Carvalho de Melo:
- Add string table generators and beautify arguments for the new fspick,
fsmount, fsconfig, fsopen, move_mount and open_tree syscalls, as well
as new values for arguments of clone and sync_file_range syscalls.
perf version:
Arnaldo Carvalho de Melo:
- Append 12 git SHA chars to the version string.
Namespaces:
Namhyung Kim:
- Add missing --namespaces option to 'perf top', to generate and process
namespace events, just like present for 'perf record'.
Intel PT:
Andrian Hunter:
- Fix itrace defaults for 'perf script', not using the 'use_browser' variable
to figure out what options are better for 'script' and 'report'
- Allow root fixing up buildid cache permissions in the perf-with-kcore.sh
script when sharing that cache with another user.
- Improve sync_switch, a facility used to synchronize decoding of HW
traces more closely with the point in the kerne where a context
switch took place, by processing the PERF_RECORD_CONTEXT_SWITCH "in"
metadata records too.
- Make the exported-sql-viewer.py GUI also support pyside2, which
upgrades from qt4 used in pyside to qt5. Use the argparser module
for more easily addition of new command line args.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
| -rwxr-xr-x | tools/perf/scripts/python/exported-sql-viewer.py | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py index affed7d149be..6fe553258ce5 100755 --- a/tools/perf/scripts/python/exported-sql-viewer.py +++ b/tools/perf/scripts/python/exported-sql-viewer.py | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #!/usr/bin/env python2 | 1 | #!/usr/bin/env python |
| 2 | # SPDX-License-Identifier: GPL-2.0 | 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | # exported-sql-viewer.py: view data from sql database | 3 | # exported-sql-viewer.py: view data from sql database |
| 4 | # Copyright (c) 2014-2018, Intel Corporation. | 4 | # Copyright (c) 2014-2018, Intel Corporation. |
| @@ -91,6 +91,7 @@ | |||
| 91 | from __future__ import print_function | 91 | from __future__ import print_function |
| 92 | 92 | ||
| 93 | import sys | 93 | import sys |
| 94 | import argparse | ||
| 94 | import weakref | 95 | import weakref |
| 95 | import threading | 96 | import threading |
| 96 | import string | 97 | import string |
| @@ -104,10 +105,23 @@ except ImportError: | |||
| 104 | glb_nsz = 16 | 105 | glb_nsz = 16 |
| 105 | import re | 106 | import re |
| 106 | import os | 107 | import os |
| 107 | from PySide.QtCore import * | 108 | |
| 108 | from PySide.QtGui import * | ||
| 109 | from PySide.QtSql import * | ||
| 110 | 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 | |||
| 111 | from decimal import * | 125 | from decimal import * |
| 112 | from ctypes import * | 126 | from ctypes import * |
| 113 | from multiprocessing import Process, Array, Value, Event | 127 | from multiprocessing import Process, Array, Value, Event |
| @@ -2754,7 +2768,7 @@ class WindowMenu(): | |||
| 2754 | action = self.window_menu.addAction(label) | 2768 | action = self.window_menu.addAction(label) |
| 2755 | action.setCheckable(True) | 2769 | action.setCheckable(True) |
| 2756 | action.setChecked(sub_window == self.mdi_area.activeSubWindow()) | 2770 | action.setChecked(sub_window == self.mdi_area.activeSubWindow()) |
| 2757 | action.triggered.connect(lambda x=nr: self.setActiveSubWindow(x)) | 2771 | action.triggered.connect(lambda a=None,x=nr: self.setActiveSubWindow(x)) |
| 2758 | self.window_menu.addAction(action) | 2772 | self.window_menu.addAction(action) |
| 2759 | nr += 1 | 2773 | nr += 1 |
| 2760 | 2774 | ||
| @@ -3114,14 +3128,14 @@ class MainWindow(QMainWindow): | |||
| 3114 | event = event.split(":")[0] | 3128 | event = event.split(":")[0] |
| 3115 | if event == "branches": | 3129 | if event == "branches": |
| 3116 | 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 + ")" |
| 3117 | 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)) |
| 3118 | 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 + ")" |
| 3119 | 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)) |
| 3120 | 3134 | ||
| 3121 | def TableMenu(self, tables, menu): | 3135 | def TableMenu(self, tables, menu): |
| 3122 | table_menu = menu.addMenu("&Tables") | 3136 | table_menu = menu.addMenu("&Tables") |
| 3123 | for table in tables: | 3137 | for table in tables: |
| 3124 | 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)) |
| 3125 | 3139 | ||
| 3126 | def NewCallGraph(self): | 3140 | def NewCallGraph(self): |
| 3127 | CallGraphWindow(self.glb, self) | 3141 | CallGraphWindow(self.glb, self) |
| @@ -3361,18 +3375,27 @@ class DBRef(): | |||
| 3361 | # Main | 3375 | # Main |
| 3362 | 3376 | ||
| 3363 | def Main(): | 3377 | def Main(): |
| 3364 | if (len(sys.argv) < 2): | 3378 | usage_str = "exported-sql-viewer.py [--pyside-version-1] <database name>\n" \ |
| 3365 | printerr("Usage is: exported-sql-viewer.py {<database name> | --help-only}"); | 3379 | " or: exported-sql-viewer.py --help-only" |
| 3366 | raise Exception("Too few arguments") | 3380 | ap = argparse.ArgumentParser(usage = usage_str, add_help = False) |
| 3367 | 3381 | ap.add_argument("--pyside-version-1", action='store_true') | |
| 3368 | dbname = sys.argv[1] | 3382 | ap.add_argument("dbname", nargs="?") |
| 3369 | if dbname == "--help-only": | 3383 | ap.add_argument("--help-only", action='store_true') |
| 3384 | args = ap.parse_args() | ||
| 3385 | |||
| 3386 | if args.help_only: | ||
| 3370 | app = QApplication(sys.argv) | 3387 | app = QApplication(sys.argv) |
| 3371 | mainwindow = HelpOnlyWindow() | 3388 | mainwindow = HelpOnlyWindow() |
| 3372 | mainwindow.show() | 3389 | mainwindow.show() |
| 3373 | err = app.exec_() | 3390 | err = app.exec_() |
| 3374 | sys.exit(err) | 3391 | sys.exit(err) |
| 3375 | 3392 | ||
| 3393 | dbname = args.dbname | ||
| 3394 | if dbname is None: | ||
| 3395 | ap.print_usage() | ||
| 3396 | print("Too few arguments") | ||
| 3397 | sys.exit(1) | ||
| 3398 | |||
| 3376 | is_sqlite3 = False | 3399 | is_sqlite3 = False |
| 3377 | try: | 3400 | try: |
| 3378 | f = open(dbname, "rb") | 3401 | f = open(dbname, "rb") |
