Interface IEdgeResourceMonitor
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 onResumed.Nullable, and that is load-bearing. SP1's merged EdgeMemoryPressure is
{ Low, Moderate, Critical }with noNonemember andLowas the zero value, so a non-nullable latch could not express "nothing has been reported" or "cleared" - it would read asLowfrom the moment the container is built. Adding aNone = 0member would renumberLow/Moderate/Criticaland is therefore not an additive change, which spec 5 forbids. null costs nothing and matches SP1's own idiom:EdgeLifecycleRecord.Levelis alreadyEdgeMemoryPressure?.This is the shared pressure signal
Qavren.Edge.Embeddings.Onnxreads 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
OnnxLifecycleObserveronly. Not part of the consumer surface. null clears the latch.