perf script python: Database export fixes
Adrian Hunter
reviewercover perf script python: Database export fixes
Hi
Here are a couple of database export fixes.
Adrian Hunter (2):
perf script python: Fix export-to-postgresql.py occasional failure perf script python: Fix export-to-sqlite.py sample columns
tools/perf/scripts/python/export-to-postgresql.py | 9 +++++++++ tools/perf/scripts/python/export-to-sqlite.py | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-)
Regards
Adrian
Adrian Hunter
reviewerPATCH 1/2 perf script python: Fix export-to-postgresql.py occasional failure
Occasional export failures were found to be caused by truncating 64-bit pointers to 32-bits. Fix by explicitly setting types for all ctype arguments and results.
--- tools/perf/scripts/python/export-to-postgresql.py | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/perf/scripts/python/export-to-postgresql.py +9 -0
@@ -204,14 +204,23 @@ from ctypes import * libpq = CDLL("libpq.so.5") PQconnectdb = libpq.PQconnectdb PQconnectdb.restype = c_void_p +PQconnectdb.argtypes = [ c_char_p ] PQfinish = libpq.PQfinish +PQfinish.argtypes = [ c_void_p ] PQstatus = libpq.PQstatus +PQstatus.restype = c_int +PQstatus.argtypes = [ c_void_p ] PQexec = libpq.PQexec PQexec.restype = c_void_p +PQexec.argtypes = [ c_void_p, c_char_p ] PQresultStatus = libpq.PQresultStatus +PQresultStatus.restype = c_int +PQresultStatus.argtypes = [ c_void_p ] PQputCopyData = libpq.PQputCopyData +PQputCopyData.restype = c_int PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] PQputCopyEnd = libpq.PQputCopyEnd +PQputCopyEnd.restype = c_int PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] sys.path.append(os.environ['PERF_EXEC_PATH'] + \
Signature · 1 line
2.17.1
tip-bot for Adrian Hunter
merge bot[tip:perf/urgent] perf script python: Fix export-to-postgresql.py occasional failure
perf script python: Fix export-to-postgresql.py occasional failure
Commit-ID: 25e11700b54c7b6b5ebfc4361981dae12299557b Gitweb: https://git.kernel.org/tip/25e11700b54c7b6b5ebfc4361981dae12299557b Author: Adrian Hunter <[email protected]> AuthorDate: Tue, 11 Sep 2018 14:45:03 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 25 Sep 2018 11:33:06 -0300
perf script python: Fix export-to-postgresql.py occasional failure
Occasional export failures were found to be caused by truncating 64-bit pointers to 32-bits. Fix by explicitly setting types for all ctype arguments and results.
--- tools/perf/scripts/python/export-to-postgresql.py | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/perf/scripts/python/export-to-postgresql.py +9 -0
@@ -204,14 +204,23 @@ from ctypes import * libpq = CDLL("libpq.so.5") PQconnectdb = libpq.PQconnectdb PQconnectdb.restype = c_void_p +PQconnectdb.argtypes = [ c_char_p ] PQfinish = libpq.PQfinish +PQfinish.argtypes = [ c_void_p ] PQstatus = libpq.PQstatus +PQstatus.restype = c_int +PQstatus.argtypes = [ c_void_p ] PQexec = libpq.PQexec PQexec.restype = c_void_p +PQexec.argtypes = [ c_void_p, c_char_p ] PQresultStatus = libpq.PQresultStatus +PQresultStatus.restype = c_int +PQresultStatus.argtypes = [ c_void_p ] PQputCopyData = libpq.PQputCopyData +PQputCopyData.restype = c_int PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] PQputCopyEnd = libpq.PQputCopyEnd +PQputCopyEnd.restype = c_int PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] sys.path.append(os.environ['PERF_EXEC_PATH'] + \
Adrian Hunter
reviewerPATCH 2/2 perf script python: Fix export-to-sqlite.py sample columns
In reply to Adrian HunterWith the "branches" export option, not all sample columns are exported. However the unwanted columns are not at the end of the tuple, as assumed by the code. Fix by taking the first 15 and last 3 values, instead of the first 18.
--- tools/perf/scripts/python/export-to-sqlite.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/scripts/python/export-to-sqlite.py +5 -1
@@ -440,7 +440,11 @@ def branch_type_table(*x): def sample_table(*x): if branches: - bind_exec(sample_query, 18, x) + for xx in x[0:15]: + sample_query.addBindValue(str(xx)) + for xx in x[19:22]: + sample_query.addBindValue(str(xx)) + do_query_(sample_query) else: bind_exec(sample_query, 22, x)
Signature · 1 line
2.17.1
tip-bot for Adrian Hunter
merge bot[tip:perf/urgent] perf script python: Fix export-to-sqlite.py sample columns
perf script python: Fix export-to-sqlite.py sample columns
Commit-ID: d005efe18db0b4a123dd92ea8e77e27aee8f99fd Gitweb: https://git.kernel.org/tip/d005efe18db0b4a123dd92ea8e77e27aee8f99fd Author: Adrian Hunter <[email protected]> AuthorDate: Tue, 11 Sep 2018 14:45:04 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 25 Sep 2018 11:37:05 -0300
perf script python: Fix export-to-sqlite.py sample columns
With the "branches" export option, not all sample columns are exported. However the unwanted columns are not at the end of the tuple, as assumed by the code. Fix by taking the first 15 and last 3 values, instead of the first 18.
--- tools/perf/scripts/python/export-to-sqlite.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/scripts/python/export-to-sqlite.py +5 -1
@@ -440,7 +440,11 @@ def branch_type_table(*x): def sample_table(*x): if branches: - bind_exec(sample_query, 18, x) + for xx in x[0:15]: + sample_query.addBindValue(str(xx)) + for xx in x[19:22]: + sample_query.addBindValue(str(xx)) + do_query_(sample_query) else: bind_exec(sample_query, 22, x)
Adrian Hunter
reviewerQuoted 5 lines · Adrian Hunter
Hi
Here are a couple of database export fixes.
Quoted 7 lines
Adrian Hunter (2):
perf script python: Fixexport-to-postgresql.pyoccasional failure perf script python: Fixexport-to-sqlite.pysample columnstools/perf/scripts/python/export-to-postgresql.py | 9 +++++++++ tools/perf/scripts/python/export-to-sqlite.py | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-)
Please consider these
Em Tue, Sep 25, 2018 at 02:08:06PM +0300, Adrian Hunter escreveu:
Quoted 10 lines · Adrian Hunter
Quoted 9 lines
Hi
Here are a couple of database export fixes.
Adrian Hunter (2):
perf script python: Fixexport-to-postgresql.pyoccasional failure perf script python: Fixexport-to-sqlite.pysample columns
Quoted 5 lines
Quoted 3 lines
tools/perf/scripts/python/export-to-postgresql.py | 9 +++++++++ tools/perf/scripts/python/export-to-sqlite.py | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-)Please consider these
Applied to perf/urgent, please consider using the Fixes: tag, so that the stable guys have a easier time (automatically even) figuring out how far back the patch should be applied.
Thanks!
- Arnaldo