Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lading/src/observer/linux/procfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ impl Sampler {
let mut pids: FxHashSet<i32> = FxHashSet::default();
let mut processes: VecDeque<Process> = VecDeque::with_capacity(16); // an arbitrary smallish number
processes.push_back(Process::new(self.parent.pid())?);
pids.insert(self.parent.pid());

while let Some(process) = processes.pop_back() {
// Search for child processes. This is done by querying for every
Expand Down Expand Up @@ -117,15 +118,16 @@ impl Sampler {
}
}
}
// Update the process_info map to only hold processes seen by the current poll call.
self.process_info.retain(|pid, _| pids.contains(pid));

let pid = process.pid();
if let Err(e) = self.handle_process(process, &mut aggr, include_smaps).await {
warn!("Encountered uncaught error when handling `/proc/{pid}/`: {e}");
}
}

// Update the process_info map to only hold processes seen by the current poll call.
self.process_info.retain(|pid, _| pids.contains(pid));

gauge!("total_rss_bytes").set(aggr.rss as f64);
gauge!("total_pss_bytes").set(aggr.pss as f64);

Expand Down
Loading