anjy7 commented on code in PR #22669:
URL: https://github.com/apache/kafka/pull/22669#discussion_r3482579045


##########
raft/src/testFixtures/java/org/apache/kafka/raft/RaftClientBenchmarkContext.java:
##########
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.raft;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.common.message.FetchRequestData;
+import org.apache.kafka.common.protocol.ApiMessage;
+import org.apache.kafka.server.common.KRaftVersion;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+public final class RaftClientBenchmarkContext {
+    private final RaftClientTestContext context;
+    private final MockLog log;
+    private final MockNetworkChannel channel;
+    private final ReplicaKey otherVoter;
+
+    private int lastFlushCount;
+    private int lastReadCount;
+    private int lastTruncationCount;
+    private int lastRequestsSent;
+    private int lastQuorumWrites;
+
+    private RaftClientBenchmarkContext(RaftClientTestContext context, 
ReplicaKey otherVoter) {
+        this.context = context;
+        this.log = context.log;
+        this.channel = context.channel;
+        this.otherVoter = otherVoter;
+        resetCounters();

Review Comment:
   yes, can do it. But this will force the benchmark write to include after 
every setup. Taking the example of `ElectionBenchmarks` setup, we don't call it 
in the setup as its being already called in the constructor. If you feel 
removing it from constructor would be cleaner, then we can do that



-- 
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]

Reply via email to