@@ -76,6 +76,9 @@ void start(String[] args) throws IOException {
7676 // not thread-safe, do not share with other threads
7777 SplittableRandom random = new SplittableRandom (0 );
7878 ProducerRecord <byte [], byte []> record ;
79+
80+ System .out .println ("DEBUG: config.warmupRecords=" + config .warmupRecords + ", (config.warmupRecords > 0)=" + (config .warmupRecords > 0 ));
81+
7982 if (config .warmupRecords > 0 ) {
8083 System .out .println ("Warmup first " + config .warmupRecords + " records. Steady state results will print after the complete test summary." );
8184 }
@@ -104,6 +107,7 @@ record = new ProducerRecord<>(config.topicName, payload);
104107 } else {
105108 if (i == config .warmupRecords ) {
106109 steadyStateStats = new Stats (config .numRecords - config .warmupRecords , DEFAULT_REPORTING_INTERVAL_MS , config .warmupRecords > 0 );
110+ stats .steadyStateActive = true ;
107111 }
108112 cb = new PerfCallback (sendStartMs , payload .length , stats , steadyStateStats );
109113 }
@@ -381,6 +385,7 @@ static class Stats {
381385 private long windowBytes ;
382386 private long windowStart ;
383387 private final boolean isSteadyState ;
388+ private boolean steadyStateActive ;
384389
385390 public Stats (long numRecords , int reportingInterval ) {
386391 this (numRecords , reportingInterval , false );
@@ -401,6 +406,7 @@ public Stats(long numRecords, int reportingInterval, boolean isSteadyState) {
401406 this .totalLatency = 0 ;
402407 this .reportingInterval = reportingInterval ;
403408 this .isSteadyState = isSteadyState ;
409+ this .steadyStateActive = isSteadyState ;
404410 }
405411
406412 Stats (Stats first , Stats second ) {
@@ -420,6 +426,7 @@ public Stats(long numRecords, int reportingInterval, boolean isSteadyState) {
420426 this .isSteadyState = false ; // false except in the steady-state case
421427 this .count = first .count + second .count ;
422428 this .bytes = first .bytes + second .bytes ;
429+ this .steadyStateActive = false ;
423430 }
424431
425432 public void record (int latency , int bytes , long time ) {
@@ -440,7 +447,9 @@ public void record(int latency, int bytes, long time) {
440447 if (this .isSteadyState && count == windowCount ) {
441448 System .out .println ("Beginning steady state." );
442449 }
443- printWindow ();
450+ if (this .isSteadyState || !this .steadyStateActive ) {
451+ printWindow ();
452+ }
444453 newWindow ();
445454 }
446455 }
0 commit comments