Table of Contents

Interface IEdgeResourceMonitor

Namespace
Qavren.Edge.Onnx
Assembly
Qavren.Edge.Onnx.dll

Apple: os_proc_available_memory() (0 means unknown or already over - treated as unknown, never as a refusal) and ProcessInfo.ThermalState/IsLowPowerModeEnabled. Android: ActivityManager.GetMemoryInfo (availMem, lowMemory), PowerManager.CurrentThermalStatus and GetThermalHeadroom(10). Desktop: GC.GetGCMemoryInfo(), advisory only. Reads are cached for one second: Android's GetThermalHeadroom is rate-limited to ~1 Hz and returns NaN when polled faster.

public interface IEdgeResourceMonitor

Properties

LastPressure

The most recent level SP1's lifecycle hub reported, latched here by OnnxLifecycleObserver (spec 14.2) and cleared to null on Resumed.

Nullable, and that is load-bearing. SP1's merged EdgeMemoryPressure is { Low, Moderate, Critical } with no None member and Low as the zero value, so a non-nullable latch could not express "nothing has been reported" or "cleared" - it would read as Low from the moment the container is built. Adding a None = 0 member would renumber Low/Moderate/Critical and is therefore not an additive change, which spec 5 forbids. null costs nothing and matches SP1's own idiom: EdgeLifecycleRecord.Level is already EdgeMemoryPressure?.

This is the shared pressure signal Qavren.Edge.Embeddings.Onnx reads to shrink its batch size: the batch size lives in the L1 package and the lifecycle observer lives in L0, so the flag has to sit in L0 or the dependency direction in spec 4.1 breaks. It is a latch, not an event stream - a reader gets the current level and nothing else.

Methods

Read()

Reads the device. Cached for one second, driven by the injected TimeProvider.

SetPressure(EdgeMemoryPressure?)

Called by OnnxLifecycleObserver only. Not part of the consumer surface. null clears the latch.