Skip to content

Commit da9df3d

Browse files
Make connection errors display backwards compatible
Only show connection errors in the per-second progress output when there are actual errors. This ensures the output format remains backwards compatible with existing scripts and tools that parse memtier output. Before: [RUN #1 50%, 10 secs] 4 threads 20 conns 0 conn errors: 1000 ops... After (no errors): [RUN #1 50%, 10 secs] 4 threads 20 conns: 1000 ops... After (with errors): [RUN #1 50%, 10 secs] 4 threads 20 conns 5 conn errors: 1000 ops... Also added ThreadSanitizer suppressions for connection error tracking functions to match existing suppressions for other stats counters.
1 parent 45469b5 commit da9df3d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

memtier_benchmark.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,8 +1520,14 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj
15201520
else
15211521
progress = 100.0 * (duration / 1000000.0)/cfg->test_time;
15221522

1523-
fprintf(stderr, "[RUN #%u %.0f%%, %3u secs] %2u threads %2u conns %lu conn errors: %11lu ops, %7lu (avg: %7lu) ops/sec, %s/sec (avg: %s/sec), %5.2f (avg: %5.2f) msec latency\r",
1524-
run_id, progress, (unsigned int) (duration / 1000000), active_threads, cfg->clients, total_connection_errors, total_ops, cur_ops_sec, ops_sec, cur_bytes_str, bytes_str, cur_latency, avg_latency);
1523+
// Only show connection errors if there are any (backwards compatible output)
1524+
if (total_connection_errors > 0) {
1525+
fprintf(stderr, "[RUN #%u %.0f%%, %3u secs] %2u threads %2u conns %lu conn errors: %11lu ops, %7lu (avg: %7lu) ops/sec, %s/sec (avg: %s/sec), %5.2f (avg: %5.2f) msec latency\r",
1526+
run_id, progress, (unsigned int) (duration / 1000000), active_threads, cfg->clients, total_connection_errors, total_ops, cur_ops_sec, ops_sec, cur_bytes_str, bytes_str, cur_latency, avg_latency);
1527+
} else {
1528+
fprintf(stderr, "[RUN #%u %.0f%%, %3u secs] %2u threads %2u conns: %11lu ops, %7lu (avg: %7lu) ops/sec, %s/sec (avg: %s/sec), %5.2f (avg: %5.2f) msec latency\r",
1529+
run_id, progress, (unsigned int) (duration / 1000000), active_threads, cfg->clients, total_ops, cur_ops_sec, ops_sec, cur_bytes_str, bytes_str, cur_latency, avg_latency);
1530+
}
15251531
} while (active_threads > 0);
15261532

15271533
fprintf(stderr, "\n\n");

0 commit comments

Comments
 (0)