MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / prune_history

Function prune_history

packages/server/src/performance.rs:772–783  ·  view source on GitHub ↗
(history: &mut VecDeque<PerformanceSample>, now_ms: u64)

Source from the content-addressed store, hash-verified

770}
771
772fn prune_history(history: &mut VecDeque<PerformanceSample>, now_ms: u64) {
773 let retention_start = now_ms.saturating_sub(HISTORY_RETENTION_MS);
774 while history
775 .front()
776 .is_some_and(|sample| sample.timestamp_ms < retention_start)
777 {
778 history.pop_front();
779 }
780 while history.len() > HISTORY_MAX_SAMPLES {
781 history.pop_front();
782 }
783}
784
785async fn sample_network(pid: i32) -> Result<NetworkSnapshot, AppError> {
786 let (received_bytes, sent_bytes) = sample_network_totals(pid).await.unwrap_or((None, None));

Callers 1

merge_samplesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected