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

Method level_for

nodedb-mem/src/pressure.rs:53–63  ·  view source on GitHub ↗

Compute the pressure level for a given utilization percentage.

(&self, utilization_percent: u8)

Source from the content-addressed store, hash-verified

51impl PressureThresholds {
52 /// Compute the pressure level for a given utilization percentage.
53 pub fn level_for(&self, utilization_percent: u8) -> PressureLevel {
54 if utilization_percent >= self.emergency {
55 PressureLevel::Emergency
56 } else if utilization_percent >= self.critical {
57 PressureLevel::Critical
58 } else if utilization_percent >= self.warning {
59 PressureLevel::Warning
60 } else {
61 PressureLevel::Normal
62 }
63 }
64}
65
66#[cfg(test)]

Callers 3

engine_pressureMethod · 0.80
global_pressureMethod · 0.80
worst_engine_pressureMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected