Skip to content

Commit 3c5b2fb

Browse files
committed
Add parameter checking to dtmbench
1 parent 03ce7eb commit 3c5b2fb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

contrib/pg_dtm/tests/dtmbench.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ int main (int argc, char* argv[])
253253
"\t-i\tinitialize datanase\n");
254254
return 1;
255255
}
256+
if (cfg.connections.size() < 2) {
257+
printf("At least two connections has to be specified\n");
258+
return 1;
259+
}
256260
if (initialize) {
257261
initializeDatabase();
258262
}
@@ -287,6 +291,10 @@ int main (int argc, char* argv[])
287291
}
288292

289293
time_t elapsed = getCurrentTime() - start;
290-
printf("TPS(updates)=%f, TPS(selects)=%f, aborts=%ld\n", (double)(nWrites*USEC)/elapsed, (double)(nReads*USEC)/elapsed, nAborts);
294+
if (elapsed == 0) {
295+
printf("Test is completed too fast\n");
296+
} else {
297+
printf("TPS(updates)=%f, TPS(selects)=%f, aborts=%ld\n", (double)(nWrites*USEC)/elapsed, (double)(nReads*USEC)/elapsed, nAborts);
298+
}
291299
return 0;
292300
}

0 commit comments

Comments
 (0)