chia7712 commented on code in PR #17340:
URL: https://github.com/apache/kafka/pull/17340#discussion_r2103734004


##########
tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java:
##########
@@ -471,6 +513,10 @@ public void onCompletion(RecordMetadata metadata, 
Exception exception) {
             if (exception == null) {
                 this.stats.record(latency, bytes, now);
                 this.stats.iteration++;
+                if (steadyStateStats != null) {
+                    this.steadyStateStats.record(latency, bytes, now);
+                    this.steadyStateStats.iteration++;

Review Comment:
   Perhaps `steadyStateStats.iteration` could be updated within 
`steadyStateStats.record`? Since record already updates many other values, 
adding iteration there should be straightforward.



##########
tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java:
##########
@@ -94,7 +98,11 @@ void start(String[] args) throws IOException {
                 record = new ProducerRecord<>(config.topicName, payload);
 
                 long sendStartMs = System.currentTimeMillis();
-                cb = new PerfCallback(sendStartMs, payload.length, stats);
+                if ( config.warmupRecords > 0 && i == config.warmupRecords ) {
+                    steadyStateStats = new Stats(config.numRecords - 
config.warmupRecords, config.warmupRecords > 0);

Review Comment:
   According to https://github.com/apache/kafka/pull/17340/files#r1972675533, 
`config.warmupRecords > 0` could be replaced by `true`, right?



##########
tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java:
##########
@@ -94,7 +98,11 @@ void start(String[] args) throws IOException {
                 record = new ProducerRecord<>(config.topicName, payload);
 
                 long sendStartMs = System.currentTimeMillis();
-                cb = new PerfCallback(sendStartMs, payload.length, stats);
+                if ( config.warmupRecords > 0 && i == config.warmupRecords ) {
+                    steadyStateStats = new Stats(config.numRecords - 
config.warmupRecords, config.warmupRecords > 0);
+                    stats.steadyStateActive = true;

Review Comment:
   It seems this is used to stop the `printWindow`, right? If so, maybe the 
better naming is `stopPrint`. WDYT?  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to