mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 09:31:50 +00:00
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>
This commit is contained in:
parent
df8ea22a8f
commit
bfb3170e24
@ -21,6 +21,26 @@ import datetime
|
|||||||
# provides LGPL-licensed Python bindings for Qt. You will also need the package
|
# provides LGPL-licensed Python bindings for Qt. You will also need the package
|
||||||
# libqt4-sql-sqlite for Qt sqlite3 support.
|
# libqt4-sql-sqlite for Qt sqlite3 support.
|
||||||
#
|
#
|
||||||
|
# Examples of installing pyside:
|
||||||
|
#
|
||||||
|
# ubuntu:
|
||||||
|
#
|
||||||
|
# $ sudo apt-get install python-pyside.qtsql libqt4-sql-psql
|
||||||
|
#
|
||||||
|
# Alternately, to use Python3 and/or pyside 2, one of the following:
|
||||||
|
#
|
||||||
|
# $ sudo apt-get install python3-pyside.qtsql libqt4-sql-psql
|
||||||
|
# $ sudo apt-get install python-pyside2.qtsql libqt5sql5-psql
|
||||||
|
# $ sudo apt-get install python3-pyside2.qtsql libqt5sql5-psql
|
||||||
|
# fedora:
|
||||||
|
#
|
||||||
|
# $ sudo yum install python-pyside
|
||||||
|
#
|
||||||
|
# Alternately, to use Python3 and/or pyside 2, one of the following:
|
||||||
|
# $ sudo yum install python3-pyside
|
||||||
|
# $ pip install --user PySide2
|
||||||
|
# $ pip3 install --user PySide2
|
||||||
|
#
|
||||||
# An example of using this script with Intel PT:
|
# An example of using this script with Intel PT:
|
||||||
#
|
#
|
||||||
# $ perf record -e intel_pt//u ls
|
# $ perf record -e intel_pt//u ls
|
||||||
@ -49,7 +69,16 @@ import datetime
|
|||||||
# difference is the 'transaction' column of the 'samples' table which is
|
# difference is the 'transaction' column of the 'samples' table which is
|
||||||
# renamed 'transaction_' in sqlite because 'transaction' is a reserved word.
|
# renamed 'transaction_' in sqlite because 'transaction' is a reserved word.
|
||||||
|
|
||||||
from PySide.QtSql import *
|
pyside_version_1 = True
|
||||||
|
if not "pyside-version-1" in sys.argv:
|
||||||
|
try:
|
||||||
|
from PySide2.QtSql import *
|
||||||
|
pyside_version_1 = False
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if pyside_version_1:
|
||||||
|
from PySide.QtSql import *
|
||||||
|
|
||||||
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
|
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
|
||||||
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
|
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
|
||||||
@ -69,11 +98,12 @@ def printdate(*args, **kw_args):
|
|||||||
print(datetime.datetime.today(), *args, sep=' ', **kw_args)
|
print(datetime.datetime.today(), *args, sep=' ', **kw_args)
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
printerr("Usage is: export-to-sqlite.py <database name> [<columns>] [<calls>] [<callchains>]");
|
printerr("Usage is: export-to-sqlite.py <database name> [<columns>] [<calls>] [<callchains>] [<pyside-version-1>]");
|
||||||
printerr("where: columns 'all' or 'branches'");
|
printerr("where: columns 'all' or 'branches'");
|
||||||
printerr(" calls 'calls' => create calls and call_paths table");
|
printerr(" calls 'calls' => create calls and call_paths table");
|
||||||
printerr(" callchains 'callchains' => create call_paths table");
|
printerr(" callchains 'callchains' => create call_paths table");
|
||||||
raise Exception("Too few arguments")
|
printerr(" pyside-version-1 'pyside-version-1' => use pyside version 1");
|
||||||
|
raise Exception("Too few or bad arguments")
|
||||||
|
|
||||||
if (len(sys.argv) < 2):
|
if (len(sys.argv) < 2):
|
||||||
usage()
|
usage()
|
||||||
@ -95,6 +125,8 @@ for i in range(3,len(sys.argv)):
|
|||||||
perf_db_export_calls = True
|
perf_db_export_calls = True
|
||||||
elif (sys.argv[i] == "callchains"):
|
elif (sys.argv[i] == "callchains"):
|
||||||
perf_db_export_callchains = True
|
perf_db_export_callchains = True
|
||||||
|
elif (sys.argv[i] == "pyside-version-1"):
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user