perf script: Add support for exporting to sqlite3
Adrian Hunter
reviewercover perf script: Add support for exporting to sqlite3
Hi
Here is a script for exporting to SQLite 3 the same data as the PostgreSQL export. The call-graph script is renamed and amended to work with both PostgreSQL and SQLite.
Adrian Hunter (5):
perf script: Fix missing call_path_id in export-to-postgresql script perf script: Fix query in call-graph-from-postgresql.py
perf script: Add support for exporting to sqlite3
perf script: Rename call-graph-from-postgresql.py to call-graph-from-sql.py perf script: Add support for sqlite3 to call-graph-from-sql.py
tools/perf/Documentation/intel-pt.txt | 6 +-
.../scripts/python/bin/export-to-sqlite-record | 8 +
.../scripts/python/bin/export-to-sqlite-report | 29 ++
...h-from-postgresql.py => call-graph-from-sql.py} | 70 ++--
tools/perf/scripts/python/export-to-postgresql.py | 5 +-
tools/perf/scripts/python/export-to-sqlite.py | 451 +++++++++++++++++++++
6 files changed, 535 insertions(+), 34 deletions(-)
create mode 100644 tools/perf/scripts/python/bin/export-to-sqlite-record
create mode 100644 tools/perf/scripts/python/bin/export-to-sqlite-report
rename tools/perf/scripts/python/{call-graph-from-postgresql.py => call-graph-from-sql.py} (87%)
create mode 100644 tools/perf/scripts/python/export-to-sqlite.pyRegards
Adrian
Adrian Hunter
reviewerPATCH 1/5 perf script: Fix missing call_path_id in export-to-postgresql script
The export does not work if only branches are exported because of a missing column in the samples table. Fix by adding the missing call_path_id.
--- tools/perf/scripts/python/export-to-postgresql.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/scripts/python/export-to-postgresql.py +2 -1
@@ -340,7 +340,8 @@ if branches: 'to_sym_offset bigint,' 'to_ip bigint,' 'branch_type integer,' - 'in_tx boolean)') + 'in_tx boolean,' + 'call_path_id bigint)') else: do_query(query, 'CREATE TABLE samples (' 'id bigint NOT NULL,'
Signature · 1 line
1.9.1
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf scripts python: Fix missing call_path_id in export-to-postgresql script
perf scripts python: Fix missing call_path_id in export-to-postgresql script
Commit-ID: c8a827285c33e7a19e81dfbff2740e1e67ca42df Gitweb: http://git.kernel.org/tip/c8a827285c33e7a19e81dfbff2740e1e67ca42df Author: Adrian Hunter <[email protected]> AuthorDate: Thu, 3 Aug 2017 11:31:26 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 15 Aug 2017 16:05:36 -0300
perf scripts python: Fix missing call_path_id in export-to-postgresql script
The export does not work if only branches are exported because of a missing column in the samples table. Fix by adding the missing call_path_id.
--- tools/perf/scripts/python/export-to-postgresql.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/scripts/python/export-to-postgresql.py +2 -1
@@ -340,7 +340,8 @@ if branches: 'to_sym_offset bigint,' 'to_ip bigint,' 'branch_type integer,' - 'in_tx boolean)') + 'in_tx boolean,' + 'call_path_id bigint)') else: do_query(query, 'CREATE TABLE samples (' 'id bigint NOT NULL,'
Adrian Hunter
reviewerPATCH 2/5 perf script: Fix query in call-graph-from-postgresql.py
In reply to Adrian HunterAdd a missing space which seemed not to affect PostgreSQL but upsets SQLite.
--- tools/perf/scripts/python/call-graph-from-postgresql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/scripts/python/call-graph-from-postgresql.py +1 -1
@@ -160,7 +160,7 @@ class TreeItem(): '( SELECT short_name FROM dsos WHERE id = ( SELECT dso_id FROM symbols WHERE id = ( SELECT symbol_id FROM call_paths WHERE id = call_path_id ) ) ), ' '( SELECT ip FROM call_paths where id = call_path_id ) ' 'FROM calls WHERE parent_call_path_id = ' + str(self.call_path_id) + ' AND comm_id = ' + str(self.comm_id) + ' AND thread_id = ' + str(self.thread_id) + - 'ORDER BY call_path_id') + ' ORDER BY call_path_id') if not ret: raise Exception("Query failed: " + query.lastError().text()) last_call_path_id = 0
Signature · 1 line
1.9.1
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf scripts python: Fix query in call-graph-from-postgresql.py
perf scripts python: Fix query in call-graph-from-postgresql.py
Commit-ID: 2295e9f850b0efbc57c81fccdd8bd8d26fe10029 Gitweb: http://git.kernel.org/tip/2295e9f850b0efbc57c81fccdd8bd8d26fe10029 Author: Adrian Hunter <[email protected]> AuthorDate: Thu, 3 Aug 2017 11:31:27 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 15 Aug 2017 16:06:20 -0300
perf scripts python: Fix query in call-graph-from-postgresql.py
Add a missing space which seemed not to affect PostgreSQL but upsets SQLite.
--- tools/perf/scripts/python/call-graph-from-postgresql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/scripts/python/call-graph-from-postgresql.py +1 -1
@@ -160,7 +160,7 @@ class TreeItem(): '( SELECT short_name FROM dsos WHERE id = ( SELECT dso_id FROM symbols WHERE id = ( SELECT symbol_id FROM call_paths WHERE id = call_path_id ) ) ), ' '( SELECT ip FROM call_paths where id = call_path_id ) ' 'FROM calls WHERE parent_call_path_id = ' + str(self.call_path_id) + ' AND comm_id = ' + str(self.comm_id) + ' AND thread_id = ' + str(self.thread_id) + - 'ORDER BY call_path_id') + ' ORDER BY call_path_id') if not ret: raise Exception("Query failed: " + query.lastError().text()) last_call_path_id = 0
Adrian Hunter
reviewerPATCH 3/5 perf script: Add support for exporting to sqlite3
In reply to Adrian HunterAdd support for exporting to SQLite 3 the same data as the PostgreSQL export.
--- tools/perf/Documentation/intel-pt.txt | 6 +- .../scripts/python/bin/export-to-sqlite-record | 8 + .../scripts/python/bin/export-to-sqlite-report | 29 ++ tools/perf/scripts/python/export-to-sqlite.py | 451 +++++++++++++++++++++ 4 files changed, 491 insertions(+), 3 deletions(-) create mode 100644 tools/perf/scripts/python/bin/export-to-sqlite-record create mode 100644 tools/perf/scripts/python/bin/export-to-sqlite-report create mode 100644 tools/perf/scripts/python/export-to-sqlite.py
tools/perf/Documentation/intel-pt.txt +3 -3
@@ -104,9 +104,9 @@ system, asynchronous, interrupt, transaction abort, trace begin, trace end, and in transaction, respectively. While it is possible to create scripts to analyze the data, an alternative -approach is available to export the data to a postgresql database. Refer to -script export-to-postgresql.py for more details, and to script -call-graph-from-postgresql.py for an example of using the database. +approach is available to export the data to a sqlite or postgresql database. +Refer to script export-to-sqlite.py or export-to-postgresql.py for more details, +and to script call-graph-from-postgresql.py for an example of using the database. There is also script intel-pt-events.py which provides an example of how to unpack the raw data for power events and PTWRITE.
tools/perf/scripts/python/bin/export-to-sqlite-record new file +8 -0
@@ -0,0 +1,8 @@ +#!/bin/bash + +# +# export perf data to a sqlite3 database. Can cover +# perf ip samples (excluding the tracepoints). No special +# record requirements, just record what you want to export. +# +perf record $@
tools/perf/scripts/python/bin/export-to-sqlite-report new file +29 -0
@@ -0,0 +1,29 @@ +#!/bin/bash +# description: export perf data to a sqlite3 database +# args: [database name] [columns] [calls] +n_args=0 +for i in "$@" +do + if expr match "$i" "-" > /dev/null ; then + break + fi + n_args=$(( $n_args + 1 )) +done +if [ "$n_args" -gt 3 ] ; then + echo "usage: export-to-sqlite-report [database name] [columns] [calls]" + exit +fi +if [ "$n_args" -gt 2 ] ; then + dbname=$1 + columns=$2 + calls=$3 + shift 3 +elif [ "$n_args" -gt 1 ] ; then + dbname=$1 + columns=$2 + shift 2 +elif [ "$n_args" -gt 0 ] ; then + dbname=$1 + shift +fi +perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/export-to-sqlite.py $dbname $columns $calls
tools/perf/scripts/python/export-to-sqlite.py new file +451 -0
451 lines not on this page · raw message
Signature · 1 line
1.9.1
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf script python: Add support for exporting to sqlite3
perf script python: Add support for exporting to sqlite3
Commit-ID: 564b9527d1ccf5d581275391e39ac4b1f29f0d08 Gitweb: http://git.kernel.org/tip/564b9527d1ccf5d581275391e39ac4b1f29f0d08 Author: Adrian Hunter <[email protected]> AuthorDate: Thu, 3 Aug 2017 11:31:28 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 15 Aug 2017 16:37:55 -0300
perf script python: Add support for exporting to sqlite3
Add support for exporting to SQLite 3 the same data as the PostgreSQL export.
Committer note:
Tested on RHEL 7.4 using the 1.2.2-4el python-pyside packages from EPEL.
--- tools/perf/Documentation/intel-pt.txt | 6 +- .../scripts/python/bin/export-to-sqlite-record | 8 + .../scripts/python/bin/export-to-sqlite-report | 29 ++ tools/perf/scripts/python/export-to-sqlite.py | 451 +++++++++++++++++++++ 4 files changed, 491 insertions(+), 3 deletions(-)
tools/perf/Documentation/intel-pt.txt +3 -3
@@ -104,9 +104,9 @@ system, asynchronous, interrupt, transaction abort, trace begin, trace end, and in transaction, respectively. While it is possible to create scripts to analyze the data, an alternative -approach is available to export the data to a postgresql database. Refer to -script export-to-postgresql.py for more details, and to script -call-graph-from-postgresql.py for an example of using the database. +approach is available to export the data to a sqlite or postgresql database. +Refer to script export-to-sqlite.py or export-to-postgresql.py for more details, +and to script call-graph-from-postgresql.py for an example of using the database. There is also script intel-pt-events.py which provides an example of how to unpack the raw data for power events and PTWRITE.
tools/perf/scripts/python/bin/export-to-sqlite-record new file +8 -0
@@ -0,0 +1,8 @@ +#!/bin/bash + +# +# export perf data to a sqlite3 database. Can cover +# perf ip samples (excluding the tracepoints). No special +# record requirements, just record what you want to export. +# +perf record $@
tools/perf/scripts/python/bin/export-to-sqlite-report new file +29 -0
@@ -0,0 +1,29 @@ +#!/bin/bash +# description: export perf data to a sqlite3 database +# args: [database name] [columns] [calls] +n_args=0 +for i in "$@" +do + if expr match "$i" "-" > /dev/null ; then + break + fi + n_args=$(( $n_args + 1 )) +done +if [ "$n_args" -gt 3 ] ; then + echo "usage: export-to-sqlite-report [database name] [columns] [calls]" + exit +fi +if [ "$n_args" -gt 2 ] ; then + dbname=$1 + columns=$2 + calls=$3 + shift 3 +elif [ "$n_args" -gt 1 ] ; then + dbname=$1 + columns=$2 + shift 2 +elif [ "$n_args" -gt 0 ] ; then + dbname=$1 + shift +fi +perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/export-to-sqlite.py $dbname $columns $calls
tools/perf/scripts/python/export-to-sqlite.py new file +451 -0
451 lines not on this page · raw message
Adrian Hunter
reviewerPATCH 4/5 perf script: Rename call-graph-from-postgresql.py to call-graph-from-sql.py
In reply to Adrian HunterRename call-graph-from-postgresql.py to call-graph-from-sql.py in preparation for adding support to it for SQLite 3.
--- tools/perf/Documentation/intel-pt.txt | 2 +- .../scripts/python/call-graph-from-postgresql.py | 327 --------------------- tools/perf/scripts/python/call-graph-from-sql.py | 327 +++++++++++++++++++++ tools/perf/scripts/python/export-to-postgresql.py | 2 +- 4 files changed, 329 insertions(+), 329 deletions(-) delete mode 100644 tools/perf/scripts/python/call-graph-from-postgresql.py create mode 100644 tools/perf/scripts/python/call-graph-from-sql.py
tools/perf/Documentation/intel-pt.txt +1 -1
@@ -106,7 +106,7 @@ in transaction, respectively. While it is possible to create scripts to analyze the data, an alternative approach is available to export the data to a sqlite or postgresql database. Refer to script export-to-sqlite.py or export-to-postgresql.py for more details, -and to script call-graph-from-postgresql.py for an example of using the database. +and to script call-graph-from-sql.py for an example of using the database. There is also script intel-pt-events.py which provides an example of how to unpack the raw data for power events and PTWRITE.
tools/perf/scripts/python/call-graph-from-postgresql.py deleted +0 -327
327 lines not on this page · raw message
tools/perf/scripts/python/call-graph-from-sql.py new file +327 -0
327 lines not on this page · raw message
tools/perf/scripts/python/export-to-postgresql.py +1 -1
@@ -59,7 +59,7 @@ import datetime # pt_example=# \q # # An example of using the database is provided by the script -# call-graph-from-postgresql.py. Refer to that script for details. +# call-graph-from-sql.py. Refer to that script for details. # # Tables: #
Signature · 1 line
1.9.1
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf script python: Rename call-graph-from-postgresql.py to call-graph-from-sql.py
perf script python: Rename call-graph-from-postgresql.py to call-graph-from-sql.py
Commit-ID: 69e6e410f1a1e69cb656e8ebddaae0ba2138b235 Gitweb: http://git.kernel.org/tip/69e6e410f1a1e69cb656e8ebddaae0ba2138b235 Author: Adrian Hunter <[email protected]> AuthorDate: Thu, 3 Aug 2017 11:31:29 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 15 Aug 2017 16:38:06 -0300
perf script python: Rename call-graph-from-postgresql.py to call-graph-from-sql.py
Rename call-graph-from-postgresql.py to call-graph-from-sql.py in preparation for adding support to it for SQLite 3.
---
tools/perf/Documentation/intel-pt.txt | 2 +-
.../{call-graph-from-postgresql.py => call-graph-from-sql.py} | 10 +++++-----
tools/perf/scripts/python/export-to-postgresql.py | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)tools/perf/Documentation/intel-pt.txt +1 -1
@@ -106,7 +106,7 @@ in transaction, respectively. While it is possible to create scripts to analyze the data, an alternative approach is available to export the data to a sqlite or postgresql database. Refer to script export-to-sqlite.py or export-to-postgresql.py for more details, -and to script call-graph-from-postgresql.py for an example of using the database. +and to script call-graph-from-sql.py for an example of using the database. There is also script intel-pt-events.py which provides an example of how to unpack the raw data for power events and PTWRITE.
tools/perf/scripts/python/call-graph-from-sql.py renamed from tools/perf/scripts/python/call-graph-from-postgresql.py +5 -5
@@ -1,6 +1,6 @@ #!/usr/bin/python2 -# call-graph-from-postgresql.py: create call-graph from postgresql database -# Copyright (c) 2014, Intel Corporation. +# call-graph-from-sql.py: create call-graph from postgresql database +# Copyright (c) 2014-2017, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License,
@@ -17,12 +17,12 @@ # Following on from the example in the export-to-postgresql.py script, a # call-graph can be displayed for the pt_example database like this: # -# python tools/perf/scripts/python/call-graph-from-postgresql.py pt_example +# python tools/perf/scripts/python/call-graph-from-sql.py pt_example # # Note this script supports connecting to remote databases by setting hostname, # port, username, password, and dbname e.g. # -# python tools/perf/scripts/python/call-graph-from-postgresql.py "hostname=myhost username=myuser password=mypassword dbname=pt_example" +# python tools/perf/scripts/python/call-graph-from-sql.py "hostname=myhost username=myuser password=mypassword dbname=pt_example" # # The result is a GUI window with a tree representing a context-sensitive # call-graph. Expanding a couple of levels of the tree and adjusting column
@@ -291,7 +291,7 @@ class MainWindow(QMainWindow): if __name__ == '__main__': if (len(sys.argv) < 2): - print >> sys.stderr, "Usage is: call-graph-from-postgresql.py <database name>" + print >> sys.stderr, "Usage is: call-graph-from-sql.py <database name>" raise Exception("Too few arguments") dbname = sys.argv[1]
tools/perf/scripts/python/export-to-postgresql.py +1 -1
@@ -59,7 +59,7 @@ import datetime # pt_example=# \q # # An example of using the database is provided by the script -# call-graph-from-postgresql.py. Refer to that script for details. +# call-graph-from-sql.py. Refer to that script for details. # # Tables: #
Adrian Hunter
reviewerPATCH 5/5 perf script: Add support for sqlite3 to call-graph-from-sql.py
In reply to Adrian HunterAdd support for SQLite 3 to the call-graph-from-sql.py script. The SQL statements work as is, so just detect the database type by checking if the SQLite 3 file exists.
--- tools/perf/scripts/python/call-graph-from-sql.py | 60 ++++++++++++++---------- 1 file changed, 36 insertions(+), 24 deletions(-)
tools/perf/scripts/python/call-graph-from-sql.py +36 -24
@@ -1,5 +1,5 @@ #!/usr/bin/python2 -# call-graph-from-sql.py: create call-graph from postgresql database +# call-graph-from-sql.py: create call-graph from sql database # Copyright (c) 2014-2017, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it
@@ -11,16 +11,17 @@ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. -# To use this script you will need to have exported data using the -# export-to-postgresql.py script. Refer to that script for details. +# To use this script you will need to have exported data using either the +# export-to-sqlite.py or the export-to-postgresql.py script. Refer to those +# scripts for details. # -# Following on from the example in the export-to-postgresql.py script, a +# Following on from the example in the export scripts, a # call-graph can be displayed for the pt_example database like this: # # python tools/perf/scripts/python/call-graph-from-sql.py pt_example # -# Note this script supports connecting to remote databases by setting hostname, -# port, username, password, and dbname e.g. +# Note that for PostgreSQL, this script supports connecting to remote databases +# by setting hostname, port, username, password, and dbname e.g. # # python tools/perf/scripts/python/call-graph-from-sql.py "hostname=myhost username=myuser password=mypassword dbname=pt_example" #
@@ -296,24 +297,35 @@ if __name__ == '__main__': dbname = sys.argv[1] - db = QSqlDatabase.addDatabase('QPSQL') - - opts = dbname.split() - for opt in opts: - if '=' in opt: - opt = opt.split('=') - if opt[0] == 'hostname': - db.setHostName(opt[1]) - elif opt[0] == 'port': - db.setPort(int(opt[1])) - elif opt[0] == 'username': - db.setUserName(opt[1]) - elif opt[0] == 'password': - db.setPassword(opt[1]) - elif opt[0] == 'dbname': - dbname = opt[1] - else: - dbname = opt + is_sqlite3 = False + try: + f = open(dbname) + if f.read(15) == "SQLite format 3": + is_sqlite3 = True + f.close() + except: + pass + + if is_sqlite3: + db = QSqlDatabase.addDatabase('QSQLITE') + else: + db = QSqlDatabase.addDatabase('QPSQL') + opts = dbname.split() + for opt in opts: + if '=' in opt: + opt = opt.split('=') + if opt[0] == 'hostname': + db.setHostName(opt[1]) + elif opt[0] == 'port': + db.setPort(int(opt[1])) + elif opt[0] == 'username': + db.setUserName(opt[1]) + elif opt[0] == 'password': + db.setPassword(opt[1]) + elif opt[0] == 'dbname': + dbname = opt[1] + else: + dbname = opt db.setDatabaseName(dbname) if not db.open():
Signature · 1 line
1.9.1
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf script python: Add support for sqlite3 to call-graph-from-sql.py
perf script python: Add support for sqlite3 to call-graph-from-sql.py
Commit-ID: 1fe03b5f2d70b48c4a10785edf2678ff05506e59 Gitweb: http://git.kernel.org/tip/1fe03b5f2d70b48c4a10785edf2678ff05506e59 Author: Adrian Hunter <[email protected]> AuthorDate: Thu, 3 Aug 2017 11:31:30 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 15 Aug 2017 17:03:38 -0300
perf script python: Add support for sqlite3 to call-graph-from-sql.py
Add support for SQLite 3 to the call-graph-from-sql.py script. The SQL statements work as is, so just detect the database type by checking if the SQLite 3 file exists.
Committer notes:
Tested collecting the PT data on a RHEL7.4, generating the SQLite3 database there and then moving it to a Fedora 26 system where the call-graph-from-sql.py script was run, using python-pyside version 1.2.2-7fc26 to see the callgraphs using Qt4.
--- tools/perf/scripts/python/call-graph-from-sql.py | 60 ++++++++++++++---------- 1 file changed, 36 insertions(+), 24 deletions(-)
tools/perf/scripts/python/call-graph-from-sql.py +36 -24
@@ -1,5 +1,5 @@ #!/usr/bin/python2 -# call-graph-from-sql.py: create call-graph from postgresql database +# call-graph-from-sql.py: create call-graph from sql database # Copyright (c) 2014-2017, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it
@@ -11,16 +11,17 @@ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. -# To use this script you will need to have exported data using the -# export-to-postgresql.py script. Refer to that script for details. +# To use this script you will need to have exported data using either the +# export-to-sqlite.py or the export-to-postgresql.py script. Refer to those +# scripts for details. # -# Following on from the example in the export-to-postgresql.py script, a +# Following on from the example in the export scripts, a # call-graph can be displayed for the pt_example database like this: # # python tools/perf/scripts/python/call-graph-from-sql.py pt_example # -# Note this script supports connecting to remote databases by setting hostname, -# port, username, password, and dbname e.g. +# Note that for PostgreSQL, this script supports connecting to remote databases +# by setting hostname, port, username, password, and dbname e.g. # # python tools/perf/scripts/python/call-graph-from-sql.py "hostname=myhost username=myuser password=mypassword dbname=pt_example" #
@@ -296,24 +297,35 @@ if __name__ == '__main__': dbname = sys.argv[1] - db = QSqlDatabase.addDatabase('QPSQL') - - opts = dbname.split() - for opt in opts: - if '=' in opt: - opt = opt.split('=') - if opt[0] == 'hostname': - db.setHostName(opt[1]) - elif opt[0] == 'port': - db.setPort(int(opt[1])) - elif opt[0] == 'username': - db.setUserName(opt[1]) - elif opt[0] == 'password': - db.setPassword(opt[1]) - elif opt[0] == 'dbname': - dbname = opt[1] - else: - dbname = opt + is_sqlite3 = False + try: + f = open(dbname) + if f.read(15) == "SQLite format 3": + is_sqlite3 = True + f.close() + except: + pass + + if is_sqlite3: + db = QSqlDatabase.addDatabase('QSQLITE') + else: + db = QSqlDatabase.addDatabase('QPSQL') + opts = dbname.split() + for opt in opts: + if '=' in opt: + opt = opt.split('=') + if opt[0] == 'hostname': + db.setHostName(opt[1]) + elif opt[0] == 'port': + db.setPort(int(opt[1])) + elif opt[0] == 'username': + db.setUserName(opt[1]) + elif opt[0] == 'password': + db.setPassword(opt[1]) + elif opt[0] == 'dbname': + dbname = opt[1] + else: + dbname = opt db.setDatabaseName(dbname) if not db.open():
Adrian Hunter
reviewerQuoted 14 lines · Adrian Hunter
Hi
Here is a script for exporting to SQLite 3 the same data as the PostgreSQL export. The call-graph script is renamed and amended to work with both PostgreSQL and SQLite.
Adrian Hunter (5):
perf script: Fix missingcall_path_idin export-to-postgresql script perf script: Fix query incall-graph-from-postgresql.py
perf script: Add support for exporting to sqlite3
perf script: Renamecall-graph-from-postgresql.pytocall-graph-from-sql.pyperf script: Add support for sqlite3 tocall-graph-from-sql.py
Quoted 11 lines
tools/perf/Documentation/intel-pt.txt | 6 +-
.../scripts/python/bin/export-to-sqlite-record | 8 +
.../scripts/python/bin/export-to-sqlite-report | 29 ++
...h-from-postgresql.py => call-graph-from-sql.py} | 70 ++--
tools/perf/scripts/python/export-to-postgresql.py | 5 +-
tools/perf/scripts/python/export-to-sqlite.py | 451 +++++++++++++++++++++
6 files changed, 535 insertions(+), 34 deletions(-)
create mode 100644 tools/perf/scripts/python/bin/export-to-sqlite-record
create mode 100644 tools/perf/scripts/python/bin/export-to-sqlite-report
rename tools/perf/scripts/python/{call-graph-from-postgresql.py => call-graph-from-sql.py} (87%)
create mode 100644 tools/perf/scripts/python/export-to-sqlite.pyAny problem with these?
Arnaldo Carvalho de Melo
maintainerEm Tue, Aug 15, 2017 at 12:25:24PM +0300, Adrian Hunter escreveu:
Quoted 27 lines · Adrian Hunter
Quoted 14 lines
Hi
Here is a script for exporting to SQLite 3 the same data as the PostgreSQL export. The call-graph script is renamed and amended to work with both PostgreSQL and SQLite.
Adrian Hunter (5):
perf script: Fix missingcall_path_idin export-to-postgresql script perf script: Fix query incall-graph-from-postgresql.py
perf script: Add support for exporting to sqlite3
perf script: Renamecall-graph-from-postgresql.pytocall-graph-from-sql.pyperf script: Add support for sqlite3 tocall-graph-from-sql.pyQuoted 11 lines
tools/perf/Documentation/intel-pt.txt | 6 +- .../scripts/python/bin/export-to-sqlite-record | 8 + .../scripts/python/bin/export-to-sqlite-report | 29 ++ ...h-from-postgresql.py => call-graph-from-sql.py} | 70 ++-- tools/perf/scripts/python/export-to-postgresql.py | 5 +- tools/perf/scripts/python/export-to-sqlite.py | 451 +++++++++++++++++++++ 6 files changed, 535 insertions(+), 34 deletions(-) create mode 100644 tools/perf/scripts/python/bin/export-to-sqlite-record create mode 100644 tools/perf/scripts/python/bin/export-to-sqlite-report rename tools/perf/scripts/python/{call-graph-from-postgresql.py => call-graph-from-sql.py} (87%) create mode 100644 tools/perf/scripts/python/export-to-sqlite.py
Quoted 1 line
Any problem with these?
Nope, will try and process them soon, sorry for the delay...
- Arnaldo