pg_test_timing: store timing deltas in int64

Commit 0b096e379e6 changed pg_test_timing to measure timing
differences in nanoseconds instead of microseconds, but the resulting
deltas continued to be stored in int32.

That can overflow for large gaps (for example, values greater than about
2.14 seconds in nanoseconds), leading to truncation or incorrect output.

This commit fixes the issue by storing measured timing deltas in int64.
This prevents overflow for large values and better matches
nanosecond-resolution measurements.

Author: Chao Li <[email protected]>
Reviewed-by: Lukas Fittl <[email protected]>
Reviewed-by: Xiaopeng Wang <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: https://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/863c4b827d92879dbd526a43a23c33fa9bd23b4f

Modified Files
--------------
src/bin/pg_test_timing/pg_test_timing.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)

Reply via email to