chia7712 commented on code in PR #17340:
URL: https://github.com/apache/kafka/pull/17340#discussion_r1883121258
##########
tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java:
##########
@@ -361,6 +400,26 @@ public Stats(long numRecords, int reportingInterval) {
this.windowBytes = 0;
this.totalLatency = 0;
this.reportingInterval = reportingInterval;
+ this.isSteadyState = isSteadyState;
+ }
+
+ Stats(Stats first, Stats second) {
Review Comment:
Could you please remove this unused constructor?
##########
tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java:
##########
@@ -506,6 +584,9 @@ public ConfigPostProcessor(ArgumentParser parser, String[]
args) throws IOExcept
if (numRecords != null && numRecords <= 0) {
throw new ArgumentParserException("--num-records should be
greater than zero", parser);
}
+ if (warmupRecords != null && warmupRecords >= numRecords) {
Review Comment:
`warmupRecords != null` is unnecessary. Also, could you please change the
type of `numRecords` and `warmupRecords` from `Long` to `long`?
##########
tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java:
##########
@@ -94,7 +98,18 @@ 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) {
+ if (i < config.warmupRecords) {
+ cb = new PerfCallback(sendStartMs, payload.length,
stats);
+ } else {
+ if (i == config.warmupRecords) {
+ steadyStateStats = new Stats(config.numRecords -
config.warmupRecords, DEFAULT_REPORTING_INTERVAL_MS, config.warmupRecords > 0);
Review Comment:
`config.warmupRecords > 0` can be replaced by `true`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]