MCPcopy Create free account
hub / github.com/5ocworkshop/bgraph / update_memory

Method update_memory

examples/demo/cls_simulation.rs:209–221  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

207 }
208
209 fn update_memory(&mut self) {
210 let alloc = if self.tick % 300 == 0 {
211 random_range(10.0, 18.0)
212 } else if self.tick % 500 == 0 {
213 random_range(-15.0, -8.0)
214 } else {
215 0.0
216 };
217 let mem_decay = (45.0 - self.mem_value) * 0.003;
218 self.mem_value =
219 (self.mem_value + random_range(-0.2, 0.3) + mem_decay + alloc).clamp(25.0, 85.0);
220 self.memory.push(self.mem_value);
221 }
222
223 fn update_btop(&mut self) {
224 // Update 20 btop CPU cores

Callers 1

updateMethod · 0.80

Calls 2

random_rangeFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected