erllama_pressure behaviour (erllama v0.1.0)
View SourceBehaviour and helpers for memory-pressure samplers used by
erllama_scheduler. A sampler is a stateless module that returns
the current {Used, Total} byte tuple for the resource it tracks
(system RAM, GPU VRAM, or a custom source).
A sampler MUST be cheap. The scheduler invokes sample/0 on every
tick (default 5 s); slow samplers will block the scheduler's mailbox.
If a sampler needs to spawn a port (e.g. nvidia-smi), it should
cache the previous reading and return it when the call would block,
or run its own background poller.
Summary
Types
-type reading() :: {non_neg_integer(), non_neg_integer()}.
-type source() :: noop | system | nvidia_smi | {module, module()}.
Callbacks
-callback sample() -> reading().