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
204204 libpq = CDLL("libpq.so.5")
205205 PQconnectdb = libpq.PQconnectdb
206206 PQconnectdb.restype = c_void_p
207+PQconnectdb.argtypes = [ c_char_p ]
207208 PQfinish = libpq.PQfinish
209+PQfinish.argtypes = [ c_void_p ]
208210 PQstatus = libpq.PQstatus
211+PQstatus.restype = c_int
212+PQstatus.argtypes = [ c_void_p ]
209213 PQexec = libpq.PQexec
210214 PQexec.restype = c_void_p
215+PQexec.argtypes = [ c_void_p, c_char_p ]
211216 PQresultStatus = libpq.PQresultStatus
217+PQresultStatus.restype = c_int
218+PQresultStatus.argtypes = [ c_void_p ]
212219 PQputCopyData = libpq.PQputCopyData
220+PQputCopyData.restype = c_int
213221 PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ]
214222 PQputCopyEnd = libpq.PQputCopyEnd
223+PQputCopyEnd.restype = c_int
215224 PQputCopyEnd.argtypes = [ c_void_p, c_void_p ]
216225
217226 sys.path.append(os.environ['PERF_EXEC_PATH'] + \