postgres-github.git / summary / log / commit / refs

commit    82c0cb4e672dbc89f0bd0013c625a3a16ee36ad6
Author:   Andres Freund <andres@anarazel.de>
Date:     Thu Apr 02 00:02:09 2026 +0000

    pg_test_timing: Reduce per-loop overhead
    
    The pg_test_timing program was previously using INSTR_TIME_GET_NANOSEC on an
    absolute instr_time value in order to do a diff, which goes against the spirit
    of how the GET_* macros are supposed to be used, and will cause overhead in a
    future change that assumes these macros are typically used on intervals only.
    
    Additionally the program was doing unnecessary work in the test loop by
    measuring the time elapsed, instead of checking the existing current time
    measurement against a target end time. To support that, introduce a new
    INSTR_TIME_ADD_NANOSEC macro that allows adding user-defined nanoseconds
    to an instr_time variable.
    
    While modifying the relevant code anyway, simplify it by not handling
    durations <= 0 in test_timing(), since duration is unsigned and 0 is
    disallowed by the caller.
    
    Author: Lukas Fittl <lukas@fittl.com>
    Reviewed-by: Andres Freund <andres@anarazel.de>
    Discussion: https://postgr.es/m/CAP53Pkyxv3-3gX+aOxC5tX0p2v9RHU+XH0iyvb64+ZnBXj92vg@mail.gmail.com

[parent: 6e36930f9aaf]