fn sample_bpf_perf_counters()

in src/samplers/cpu/mod.rs [279:295]


    fn sample_bpf_perf_counters(&self) -> Result<(), std::io::Error> {
        if let Some(ref bpf) = self.perf {
            let bpf = bpf.lock().unwrap();
            let time = Instant::now();
            for stat in self.statistics.iter().filter(|s| s.table().is_some()) {
                if let Ok(table) = &(*bpf).inner.table(stat.table().unwrap()) {
                    let map = crate::common::bpf::perf_table_to_map(table);
                    let mut total = 0;
                    for (_cpu, count) in map.iter() {
                        total += count;
                    }
                    let _ = self.metrics().record_counter(stat, time, total);
                }
            }
        }
        Ok(())
    }