# `Linx.Cgroup.Stats`
[🔗](https://github.com/oshlabs/linx/blob/v0.2.0/lib/linx/cgroup/stats.ex#L1)

A snapshot of a cgroup's resource counters.

Returned by `Linx.Cgroup.stats/1`. Each field is `nil` if its
source isn't available on this cgroup — either because the
controller isn't delegated to the parent (so the interface file
doesn't exist) or because the kernel is too old to expose it
(e.g. `memory.peak` requires Linux ≥ 5.19).

## Fields

  * `:cpu_usec` — total CPU time in microseconds (user + kernel),
    from `cpu.stat`'s `usage_usec`.
  * `:cpu_user_usec` — userspace CPU time in microseconds.
  * `:cpu_system_usec` — kernel CPU time in microseconds.
  * `:cpu_nr_throttled` — number of times the cgroup was
    throttled by `cpu.max`. Always 0 unless a CPU limit is set.
  * `:cpu_throttled_usec` — total time the cgroup spent
    throttled, in microseconds.
  * `:memory_current` — current memory usage in bytes
    (`memory.current`).
  * `:memory_peak` — high-water memory usage in bytes
    (`memory.peak`; requires Linux ≥ 5.19).
  * `:pids_current` — current number of processes (`pids.current`).

## Inspect

Renders compactly, showing only the fields that are populated:

    #Linx.Cgroup.Stats<cpu=12.3s mem=42MiB pids=3>

# `t`

```elixir
@type t() :: %Linx.Cgroup.Stats{
  cpu_nr_throttled: non_neg_integer() | nil,
  cpu_system_usec: non_neg_integer() | nil,
  cpu_throttled_usec: non_neg_integer() | nil,
  cpu_usec: non_neg_integer() | nil,
  cpu_user_usec: non_neg_integer() | nil,
  memory_current: non_neg_integer() | nil,
  memory_peak: non_neg_integer() | nil,
  pids_current: non_neg_integer() | nil
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
