fn sample_bpf()

in src/samplers/scheduler/mod.rs [256:285]


    fn sample_bpf(&self) -> Result<(), std::io::Error> {
        // sample bpf
        {
            if self.bpf_last.lock().unwrap().elapsed()
                >= Duration::from_secs(self.general_config().window() as u64)
            {
                if let Some(ref bpf) = self.bpf {
                    let bpf = bpf.lock().unwrap();
                    let time = Instant::now();
                    for statistic in self.statistics.iter().filter(|s| s.bpf_table().is_some()) {
                        if let Ok(mut table) = (*bpf).inner.table(statistic.bpf_table().unwrap()) {
                            for (&value, &count) in &map_from_table(&mut table) {
                                if count > 0 {
                                    let _ = self.metrics().record_bucket(
                                        statistic,
                                        time,
                                        value * MICROSECOND,
                                        count,
                                    );
                                }
                            }
                        }
                    }
                }
                *self.bpf_last.lock().unwrap() = Instant::now();
            }
        }

        Ok(())
    }