public synchronized void tick ( ) { long currentTime = GVRTime . getMilliTime ( ) ; long cutoffTime = currentTime - BUFFER_SECONDS * 1000 ; ListIterator < Long > it = mTimestamps . listIterator ( ) ; while ( it . hasNext ( ) ) { Long timestamp = it . next ( ) ; if ( timestamp < cutoffTime ) { it . remove ( ) ; } else { break ; } } mTimestamps . add ( currentTime ) ; mStatColumn . addValue ( ( ( float ) mTimestamps . size ( ) ) / BUFFER_SECONDS ) ; }
Should be called each frame .