use crate::sampler::ProcessSnapshot;
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "macos")]
mod macos;
pub trait ProcessSampler: Send {
fn sample_tree(&mut self, root_pid: i32) -> Vec<ProcessSnapshot>;
}
#[must_use]
pub fn new_sampler() -> Box<dyn ProcessSampler> {
#[cfg(target_os = "linux")]
{
Box::new(linux::LinuxSampler::new())
}
#[cfg(target_os = "macos")]
{
Box::new(macos::MacosSampler::new())
}
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
{
compile_error!("tricord supports Linux and macOS only");
}
}