From 98d0e7bc5a548e7704a8ba6e507b83a38d3dc2a8 Mon Sep 17 00:00:00 2001 From: Alexandre Felipe Date: Sun, 15 Nov 2026 05:24:12 +0000 Subject: [v2.3 PATCH 2/2] pg_regress: report group effective concurrency A concurrent group having 20 concurrent tests won't necessarily be 20 times faster than running the tests sequentially, specially if the tests durations are very different, e.g. if one test takes 10x longer than the second longest test most of the time the concurrency is 1, because each test is executed isolated from the rest. This commit measures the effective concurrency of the tests and provide a hint of how much there is to gain from improving test concurrency. --- src/test/regress/pg_regress.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index 97c26b76937..70952721f2c 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -1713,6 +1713,30 @@ log_child_failure(int exitstatus) diag("(test process exited with unrecognized status %d)", exitstatus); } +/* + * During the test execution the concurrency level varies + * this computes the average concurrency from the moment the + * first test starts to the moment the last test stops. + */ +static void +log_group_concurrency(instr_time *test_start, instr_time *test_stop, int num_tests) +{ + double group_start = INSTR_TIME_GET_NANOSEC(test_start[0]); + double group_stop = INSTR_TIME_GET_NANOSEC(test_stop[0]); + double total = (group_stop - group_start); + for(int i = 1; i < num_tests; i++) + { + double t0 = INSTR_TIME_GET_NANOSEC(test_start[i]); + double tf = INSTR_TIME_GET_NANOSEC(test_stop[i]); + if (i == 0 || (t0 < group_start)) + group_start = t0; + if (i == 0 || (tf > group_stop)) + group_stop = tf; + total += tf - t0; + } + note("effective concurrency %.2f / %d", total / (group_stop - group_start), num_tests); +} + /* * Run all the tests specified in one schedule file * @@ -1900,6 +1924,9 @@ run_group: note_end(); } + if(num_tests > 1) + log_group_concurrency(starttimes, stoptimes, num_tests); + /* Check results for all tests */ for (i = 0; i < num_tests; i++) { -- 2.53.0