Simple cpu usage statistics.
Samples are calculated as du/dt
once a second where:
du = Used user + system time since last sample dt = elapsed "wall clock" time since last sample
That is, each sample is the average cpu usage of the program over the last second.
module Sampler : sig ... end
val samples : unit ‑> Core.Percent.t Async_extra__.Import.Pipe.Reader.t
Returns a pipe of samples as described above, one per second.
Pushback is not honored on the pipe and the pipe will grow unbounded in memory if it is not read from.
module Summary : sig ... end
val summaries : windows:Core.Time.Span.t list ‑> (Core.Time.Span.t * Summary.t) Async_extra__.Import.Pipe.Reader.t
Get summarized cpu usage. Each window is the duration over which the summary should be calculated. The underlying data structure adapts to keep a sufficiently large history of samples to calculate summaries for all windows. The pipe will deliver one update per window per second. Window durations are rounded up to the nearest second.
Pushback is not honored on the pipe and the pipe will grow unbounded in memory if it is not read from.