Skip to content

Commit d1e1aa9

Browse files
committed
Update timer and metrics based on total cycles instead of idle cycles
1 parent 88033f1 commit d1e1aa9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

core/src/lcore/rx_core.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ where
103103
let mbufs: Vec<Mbuf> = self.rx_burst(rxqueue, 32);
104104
if mbufs.is_empty() {
105105
IDLE_CYCLES.inc();
106-
107-
if IDLE_CYCLES.get() & 1023 == 512 {
108-
now = Instant::now();
109-
}
110-
111-
#[cfg(feature = "prometheus")]
112-
if IDLE_CYCLES.get() & 1023 == 0 && self.is_prometheus_enabled {
113-
crate::stats::update_thread_local_stats(self.id);
114-
}
115106
}
107+
116108
TOTAL_CYCLES.inc();
109+
if TOTAL_CYCLES.get() & 1023 == 512 {
110+
now = Instant::now();
111+
}
112+
#[cfg(feature = "prometheus")]
113+
if TOTAL_CYCLES.get() & 1023 == 0 && self.is_prometheus_enabled {
114+
crate::stats::update_thread_local_stats(self.id);
115+
}
116+
117117
for mbuf in mbufs.into_iter() {
118118
// log::debug!("{:#?}", mbuf);
119119
// log::debug!("Mark: {}", mbuf.mark());

0 commit comments

Comments
 (0)