package kaun-board
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=96d35ce03dfbebd2313657273e24c2e2d20f9e6c7825b8518b69bd1d6ed5870f
sha512=90c5053731d4108f37c19430e45456063e872b04b8a1bbad064c356e1b18e69222de8bfcf4ec14757e71f18164ec6e4630ba770dbcb1291665de5418827d1465
doc/kaun-board.sysstat/Sysstat/Proc/Self/index.html
Module Proc.SelfSource
Current process (self) statistics.
type t = {utime : float;(*Cumulative user-mode CPU time in seconds.
*)stime : float;(*Cumulative system-mode CPU time in seconds.
*)rss_bytes : int64;(*Resident set size (physical memory) in bytes.
*)vsize_bytes : int64;(*Virtual memory size in bytes.
*)
}Raw process snapshot for delta calculation.
Contains cumulative CPU time and instantaneous memory usage for the current process. CPU times are in seconds (converted from platform-specific units by Unix.times).
type stats = {cpu_percent : float;(*CPU usage percentage (0.0 to 100.0 per core, or total if
*)num_coresprovided).rss_bytes : int64;(*Resident set size in bytes.
*)vsize_bytes : int64;(*Virtual memory size in bytes.
*)
}Computed process statistics.
sample () returns raw CPU times and memory usage for the current process.
Uses Unix.times for CPU times.
compute ~prev ~next ~dt ~num_cores computes CPU usage percentage between two samples.
CPU percentage is calculated as ((utime_delta + stime_delta) / dt) * 100. If num_cores is provided, the percentage is normalized by dividing by the number of cores, yielding a value in 0.0 to 100.0. Without normalization, the value can exceed 100.0 on multi-core systems.
The result is clamped to prevent spurious values from timing anomalies:
- With
num_cores: capped at100.0 - Without
num_cores: capped at800.0
If dt is outside the range (0.01, 10.0), returns 0.0 for cpu_percent to avoid division by near-zero or implausibly large intervals.