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/export-to-postgresql.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/export-to-postgresql.py')
| -rw-r--r-- | tools/perf/scripts/python/export-to-postgresql.py | 43 |
1 files 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 | |||
| 27 | # | 27 | # |
| 28 | # fedora: | 28 | # fedora: |
| 29 | # | 29 | # |
| 30 | # $ sudo yum install postgresql postgresql-server python-pyside qt-postgresql | 30 | # $ sudo yum install postgresql postgresql-server qt-postgresql |
| 31 | # $ sudo su - postgres -c initdb | 31 | # $ sudo su - postgres -c initdb |
| 32 | # $ sudo service postgresql start | 32 | # $ sudo service postgresql start |
| 33 | # $ sudo su - postgres | 33 | # $ sudo su - postgres |
| 34 | # $ createuser <your user id here> | 34 | # $ createuser -s <your user id here> # Older versions may not support -s, in which case answer the prompt below: |
| 35 | # Shall the new role be a superuser? (y/n) y | 35 | # Shall the new role be a superuser? (y/n) y |
| 36 | # $ sudo yum install python-pyside | ||
| 37 | # | ||
| 38 | # Alternately, to use Python3 and/or pyside 2, one of the following: | ||
| 39 | # $ sudo yum install python3-pyside | ||
| 40 | # $ pip install --user PySide2 | ||
| 41 | # $ pip3 install --user PySide2 | ||
| 36 | # | 42 | # |
| 37 | # ubuntu: | 43 | # ubuntu: |
| 38 | # | 44 | # |
| 39 | # $ sudo apt-get install postgresql python-pyside.qtsql libqt4-sql-psql | 45 | # $ sudo apt-get install postgresql |
| 40 | # $ sudo su - postgres | 46 | # $ sudo su - postgres |
| 41 | # $ createuser -s <your user id here> | 47 | # $ createuser -s <your user id here> |
| 48 | # $ sudo apt-get install python-pyside.qtsql libqt4-sql-psql | ||
| 49 | # | ||
| 50 | # Alternately, to use Python3 and/or pyside 2, one of the following: | ||
| 51 | # | ||
| 52 | # $ sudo apt-get install python3-pyside.qtsql libqt4-sql-psql | ||
| 53 | # $ sudo apt-get install python-pyside2.qtsql libqt5sql5-psql | ||
| 54 | # $ sudo apt-get install python3-pyside2.qtsql libqt5sql5-psql | ||
| 42 | # | 55 | # |
| 43 | # An example of using this script with Intel PT: | 56 | # An example of using this script with Intel PT: |
| 44 | # | 57 | # |
| @@ -199,7 +212,16 @@ import datetime | |||
| 199 | # 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)) | 212 | # 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)) |
| 200 | # call_path_id = query.value(6) | 213 | # call_path_id = query.value(6) |
| 201 | 214 | ||
| 202 | from PySide.QtSql import * | 215 | pyside_version_1 = True |
| 216 | if not "pyside-version-1" in sys.argv: | ||
| 217 | try: | ||
| 218 | from PySide2.QtSql import * | ||
| 219 | pyside_version_1 = False | ||
| 220 | except: | ||
| 221 | pass | ||
| 222 | |||
| 223 | if pyside_version_1: | ||
| 224 | from PySide.QtSql import * | ||
| 203 | 225 | ||
| 204 | if sys.version_info < (3, 0): | 226 | if sys.version_info < (3, 0): |
| 205 | def toserverstr(str): | 227 | def toserverstr(str): |
| @@ -255,11 +277,12 @@ def printdate(*args, **kw_args): | |||
| 255 | print(datetime.datetime.today(), *args, sep=' ', **kw_args) | 277 | print(datetime.datetime.today(), *args, sep=' ', **kw_args) |
| 256 | 278 | ||
| 257 | def usage(): | 279 | def usage(): |
| 258 | printerr("Usage is: export-to-postgresql.py <database name> [<columns>] [<calls>] [<callchains>]") | 280 | printerr("Usage is: export-to-postgresql.py <database name> [<columns>] [<calls>] [<callchains>] [<pyside-version-1>]"); |
| 259 | printerr("where: columns 'all' or 'branches'") | 281 | printerr("where: columns 'all' or 'branches'"); |
| 260 | printerr(" calls 'calls' => create calls and call_paths table") | 282 | printerr(" calls 'calls' => create calls and call_paths table"); |
| 261 | printerr(" callchains 'callchains' => create call_paths table") | 283 | printerr(" callchains 'callchains' => create call_paths table"); |
| 262 | raise Exception("Too few arguments") | 284 | printerr(" pyside-version-1 'pyside-version-1' => use pyside version 1"); |
| 285 | raise Exception("Too few or bad arguments") | ||
| 263 | 286 | ||
| 264 | if (len(sys.argv) < 2): | 287 | if (len(sys.argv) < 2): |
| 265 | usage() | 288 | usage() |
| @@ -281,6 +304,8 @@ for i in range(3,len(sys.argv)): | |||
| 281 | perf_db_export_calls = True | 304 | perf_db_export_calls = True |
| 282 | elif (sys.argv[i] == "callchains"): | 305 | elif (sys.argv[i] == "callchains"): |
| 283 | perf_db_export_callchains = True | 306 | perf_db_export_callchains = True |
| 307 | elif (sys.argv[i] == "pyside-version-1"): | ||
| 308 | pass | ||
| 284 | else: | 309 | else: |
| 285 | usage() | 310 | usage() |
| 286 | 311 | ||
