Skip to main content

retina_core/timing/
macros.rs

1macro_rules! tsc_start {
2    ( $start:ident ) => {
3        #[cfg(feature = "timing")]
4        let $start = unsafe { $crate::dpdk::rte_rdtsc() };
5    };
6}
7
8macro_rules! tsc_record {
9    ( $timers:expr, $timer:expr, $start:ident ) => {
10        #[cfg(feature = "timing")]
11        $timers.record($timer, unsafe { $crate::dpdk::rte_rdtsc() } - $start, 1);
12    };
13    ( $timers:expr, $timer:expr, $start:ident, $sample:literal ) => {
14        #[cfg(feature = "timing")]
15        $timers.record(
16            $timer,
17            unsafe { $crate::dpdk::rte_rdtsc() } - $start,
18            $sample,
19        );
20    };
21}