package kaun-board

  1. Overview
  2. Docs
Training dashboard and logging for Raven

Install

dune-project
 Dependency

Authors

Maintainers

Sources

raven-1.0.0.alpha3.tbz
sha256=96d35ce03dfbebd2313657273e24c2e2d20f9e6c7825b8518b69bd1d6ed5870f
sha512=90c5053731d4108f37c19430e45456063e872b04b8a1bbad064c356e1b18e69222de8bfcf4ec14757e71f18164ec6e4630ba770dbcb1291665de5418827d1465

doc/kaun-board.sysstat/Sysstat/Proc/Self/index.html

Module Proc.SelfSource

Current process (self) statistics.

Sourcetype t = {
  1. utime : float;
    (*

    Cumulative user-mode CPU time in seconds.

    *)
  2. stime : float;
    (*

    Cumulative system-mode CPU time in seconds.

    *)
  3. rss_bytes : int64;
    (*

    Resident set size (physical memory) in bytes.

    *)
  4. 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).

Sourcetype stats = {
  1. cpu_percent : float;
    (*

    CPU usage percentage (0.0 to 100.0 per core, or total if num_cores provided).

    *)
  2. rss_bytes : int64;
    (*

    Resident set size in bytes.

    *)
  3. vsize_bytes : int64;
    (*

    Virtual memory size in bytes.

    *)
}

Computed process statistics.

Sourceval sample : unit -> t

sample () returns raw CPU times and memory usage for the current process.

Uses Unix.times for CPU times.

  • raises Sys_error

    if an error occurs during sampling.

Sourceval compute : prev:t -> next:t -> dt:float -> num_cores:int option -> stats

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 at 100.0
  • Without num_cores: capped at 800.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.