pg: Add query tracing & prepare/execute time measurements

What I'd really like, in addition to this, is a way to extract a query
from an $st object that can be run in the psql CLI. VNDB has a debugging
feature for that, but it's less trivial to make that work with binary
query parameters.
This commit is contained in:
Yorhel 2025-02-22 15:14:51 +01:00
parent a5f9584b02
commit b2d676b1ed
6 changed files with 269 additions and 54 deletions

View file

@ -170,3 +170,9 @@ static SV *fustr_done_(pTHX_ fustr *s) {
#define fustr_writebeT(T, bits, s, in) fu_tobeT(T, bits, fustr_write_buf(s, bits>>3), in)
#define fustr_writebeI(bits, s, in) fustr_writebeT(I##bits, bits, s, in)
#define fustr_writebeU(bits, s, in) fustr_writebeT(U##bits, bits, s, in)
/* Return the difference between two struct timespecs as fractional seconds. */
static double fu_timediff(const struct timespec *a, const struct timespec *b) {
return ((double)(a->tv_sec - b->tv_sec)) + (double)(a->tv_nsec - b->tv_nsec) / 1000000000.0;
}