Purge undesired values Removes values from the buffers that: - Are before a certain TSC - are greater than a specified rtt
(&mut self, before: TscCount)
| 160 | /// - Are before a certain TSC |
| 161 | /// - are greater than a specified rtt |
| 162 | pub fn expunge_old(&mut self, before: TscCount) { |
| 163 | self.buffer.retain(|event| { |
| 164 | // Now, I would normally like to NOT have any logging in a low level function like this |
| 165 | // But I don't have a way of returning the dropped values without allocating. |
| 166 | // |
| 167 | // Logging at a debug level |
| 168 | if event.tsc_post() >= before { |
| 169 | true |
| 170 | } else { |
| 171 | tracing::debug!(?event, "Purging stale event"); |
| 172 | false |
| 173 | } |
| 174 | }); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | /// Specify the quarter in [`RingBuffer::min_rtt_in_quarter`] to use |