public void forEach ( final CounterConsumer consumer ) { int counterId = 0 ; final AtomicBuffer metaDataBuffer = this . metaDataBuffer ; final AtomicBuffer valuesBuffer = this . valuesBuffer ; for ( int i = 0 , capacity = metaDataBuffer . capacity ( ) ; i < capacity ; i += METADATA_LENGTH ) { final int recordStatus = metaDataBuffer . getIntVolatile ( i ) ; if ( RECORD_ALLOCATED == recordStatus ) { consumer . accept ( valuesBuffer . getLongVolatile ( counterOffset ( counterId ) ) , counterId , labelValue ( metaDataBuffer , i ) ) ; } else if ( RECORD_UNUSED == recordStatus ) { break ; } counterId ++ ; } }
Iterate over the counters and provide the value and basic metadata .