public int count() {
        int count = 0;
        for (List<ConsumerRecord<K, V>> recs: this.records.values())
            count += recs.size();
        return count;
    }
The number of records for all topics
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerRecords.java