public CumulativeStats reset() {
        CumulativeStats cumulativeStats = new CumulativeStats();
        messagesSent.reset();
        messagesSendFailed.reset();
        bytesSent.reset();
        sendLatencyMicros.reset();
        messagesReceived.reset();
        bytesReceived.reset();
        endToEndLatencyMicros.reset();
        cumulativeStats.totalMessagesSent = totalMessagesSent.sumThenReset();
        cumulativeStats.totalMessagesSendFailed = totalMessagesSendFailed.sumThenReset();
        cumulativeStats.totalBytesSent = totalBytesSent.sumThenReset();
        cumulativeStats.totalMessagesReceived = totalMessagesReceived.sumThenReset();
        cumulativeStats.totalBytesReceived = totalBytesReceived.sumThenReset();
        cumulativeStats.totalSendLatencyMicros = totalSendLatencyMicros.copy();
        totalSendLatencyMicros.reset();
        cumulativeStats.totalEndToEndLatencyMicros = totalEndToEndLatencyMicros.copy();
        totalEndToEndLatencyMicros.reset();
        return cumulativeStats;
    }
Reset all counters and return the cumulative stats.
tools/src/main/java/org/apache/kafka/tools/automq/perf/Stats.java