History

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.

Adrian Hunter committed 8 years ago

Commit 25e11701 parent 5d05dfd1 file · +9 −0Browse files

Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all

Unified · Split

tools/perf/scripts/python/export-to-postgresql.py+9−0
@@ -204,14 +204,23 @@ from ctypes import * · 203 unmodified lines
204libpq = CDLL("libpq.so.5")204libpq = CDLL("libpq.so.5")
205PQconnectdb = libpq.PQconnectdb205PQconnectdb = libpq.PQconnectdb
206PQconnectdb.restype = c_void_p206PQconnectdb.restype = c_void_p
207PQconnectdb.argtypes = [ c_char_p ]
207PQfinish = libpq.PQfinish208PQfinish = libpq.PQfinish
209PQfinish.argtypes = [ c_void_p ]
208PQstatus = libpq.PQstatus210PQstatus = libpq.PQstatus
211PQstatus.restype = c_int
212PQstatus.argtypes = [ c_void_p ]
209PQexec = libpq.PQexec213PQexec = libpq.PQexec
210PQexec.restype = c_void_p214PQexec.restype = c_void_p
215PQexec.argtypes = [ c_void_p, c_char_p ]
211PQresultStatus = libpq.PQresultStatus216PQresultStatus = libpq.PQresultStatus
217PQresultStatus.restype = c_int
218PQresultStatus.argtypes = [ c_void_p ]
212PQputCopyData = libpq.PQputCopyData219PQputCopyData = libpq.PQputCopyData
220PQputCopyData.restype = c_int
213PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ]221PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ]
214PQputCopyEnd = libpq.PQputCopyEnd222PQputCopyEnd = libpq.PQputCopyEnd
223PQputCopyEnd.restype = c_int
215PQputCopyEnd.argtypes = [ c_void_p, c_void_p ]224PQputCopyEnd.argtypes = [ c_void_p, c_void_p ]
216 225
217sys.path.append(os.environ['PERF_EXEC_PATH'] + \226sys.path.append(os.environ['PERF_EXEC_PATH'] + \