aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/export-to-sqlite.py
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-05-30 03:47:57 -0400
committerIngo Molnar <mingo@kernel.org>2019-05-30 03:47:57 -0400
commitb33fb3cf6f5e039dea4a85a708a2c86f8a323575 (patch)
tree50daac162069c464a67b6509a2b92c88649b7210 /tools/perf/scripts/python/export-to-sqlite.py
parent849e96f30068d4f6f8352715e02a10533a46deba (diff)
parent14f1cfd4f7b4794e2f9d2ae214bcf049654b0b5c (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/export-to-sqlite.py')
-rw-r--r--tools/perf/scripts/python/export-to-sqlite.py44
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
52from PySide.QtSql import * 72pyside_version_1 = True
73if not "pyside-version-1" in sys.argv:
74 try:
75 from PySide2.QtSql import *
76 pyside_version_1 = False
77 except:
78 pass
79
80if pyside_version_1:
81 from PySide.QtSql import *
53 82
54sys.path.append(os.environ['PERF_EXEC_PATH'] + \ 83sys.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
71def usage(): 100def 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
78if (len(sys.argv) < 2): 108if (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