Fix reporting of skipped transactions in pgbench.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 17 Aug 2015 07:11:47 +0000 (10:11 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 17 Aug 2015 07:13:51 +0000 (10:13 +0300)
Broken by commit 1bc90f7a.

Fabien Coelho.

src/bin/pgbench/pgbench.c

index 6f5bd994a09df8922bcbf3b45d9bb3c34eba426d..2e55c906b620ca6021ea350ca151a555bb0156fd 100644 (file)
@@ -3447,8 +3447,8 @@ main(int argc, char **argv)
 
        /* thread level stats */
        throttle_lag += thread->throttle_lag;
-       throttle_latency_skipped = threads->throttle_latency_skipped;
-       latency_late = thread->latency_late;
+       throttle_latency_skipped += threads->throttle_latency_skipped;
+       latency_late += thread->latency_late;
        if (throttle_lag_max > thread->throttle_lag_max)
            throttle_lag_max = thread->throttle_lag_max;
        INSTR_TIME_ADD(conn_total_time, thread->conn_time);
@@ -3759,7 +3759,10 @@ threadRun(void *arg)
                }
 
                for (i = 0; i < progress_nthreads; i++)
+               {
+                   skipped += thread[i].throttle_latency_skipped;
                    lags += thread[i].throttle_lag;
+               }
 
                total_run = (now - thread_start) / 1000000.0;
                tps = 1000000.0 * (count - last_count) / run;
@@ -3767,7 +3770,6 @@ threadRun(void *arg)
                sqlat = 1.0 * (sqlats - last_sqlats) / (count - last_count);
                stdev = 0.001 * sqrt(sqlat - 1000000.0 * latency * latency);
                lag = 0.001 * (lags - last_lags) / (count - last_count);
-               skipped = thread->throttle_latency_skipped - last_skipped;
 
                fprintf(stderr,
                        "progress: %.1f s, %.1f tps, "
@@ -3777,7 +3779,8 @@ threadRun(void *arg)
                {
                    fprintf(stderr, ", lag %.3f ms", lag);
                    if (latency_limit)
-                       fprintf(stderr, ", " INT64_FORMAT " skipped", skipped);
+                       fprintf(stderr, ", " INT64_FORMAT " skipped",
+                               skipped - last_skipped);
                }
                fprintf(stderr, "\n");
 
@@ -3786,7 +3789,7 @@ threadRun(void *arg)
                last_sqlats = sqlats;
                last_lags = lags;
                last_report = now;
-               last_skipped = thread->throttle_latency_skipped;
+               last_skipped = skipped;
 
                /*
                 * Ensure that the next report is in the future, in case