public PeriodStats toPeriodStats() {
        PeriodStats periodStats = new PeriodStats();
        periodStats.messagesSent = messagesSent.sumThenReset();
        periodStats.messagesSendFailed = messagesSendFailed.sumThenReset();
        periodStats.bytesSent = bytesSent.sumThenReset();
        periodStats.sendLatencyMicros = sendLatencyMicros.getIntervalHistogram();
        periodStats.messagesReceived = messagesReceived.sumThenReset();
        periodStats.bytesReceived = bytesReceived.sumThenReset();
        periodStats.endToEndLatencyMicros = endToEndLatencyMicros.getIntervalHistogram();
        periodStats.totalMessagesSent = totalMessagesSent.sum();
        periodStats.totalMessagesReceived = totalMessagesReceived.sum();
        return periodStats;
    }
Get period stats.
Note: This method resets the period counters.
tools/src/main/java/org/apache/kafka/tools/automq/perf/Stats.java