MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / utilization

Method utilization

nodedb-bridge/src/buffer.rs:198–203  ·  view source on GitHub ↗

Returns the current queue utilization as a percentage (0-100).

(&self)

Source from the content-addressed store, hash-verified

196
197 /// Returns the current queue utilization as a percentage (0-100).
198 pub fn utilization(&self) -> u8 {
199 let tail = self.shared.tail.value.load(Ordering::Relaxed);
200 let head = self.shared.head.value.load(Ordering::Relaxed);
201 let pending = tail.wrapping_sub(head) as usize;
202 ((pending * 100) / self.shared.capacity) as u8
203 }
204
205 /// Returns the number of items currently in the queue.
206 pub fn len(&self) -> usize {

Callers 1

try_send_requestMethod · 0.45

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected