# `Beamchmark.Suite.Measurements.CpuInfo`
[🔗](https://github.com/membraneframework/beamchmark/blob/v1.4.2/lib/beamchmark/suite/measurements/cpu_info.ex#L1)

Module representing statistics about cpu usage.

Method of measuring:
  - Take a snapshot of cpu usage every `cpu_interval` milliseconds
  - Calculate the average cpu usage of processor (combining each core usage)
  - At the end combine the results and calculate the average

**Warning!**
  This module can give unstable cpu usage values when measuring a short time because of a high cpu volatility.
  TODO Can be improved by taking average of 5-10 values for each snapshot

# `cpu_snapshot_t`

```elixir
@type cpu_snapshot_t() :: %{
  timestamp: pos_integer(),
  cpu_usage: %{
    required(core_id :: integer()) =&gt; usage :: Beamchmark.Math.percent_t()
  },
  average_all_cores: average_all_cores :: Beamchmark.Math.percent_t()
}
```

All information gathered via single snapshot + processor average

# `t`

```elixir
@type t() :: %Beamchmark.Suite.Measurements.CpuInfo{
  average_all: Beamchmark.Math.percent_t() | float(),
  average_by_core: %{
    required(core_id :: number()) =&gt;
      usage :: Beamchmark.Math.percent_t() | float()
  },
  cpu_snapshots: [cpu_snapshot_t()] | nil
}
```

All information gathered via all snapshots
`all_average` is average from all snapshots

# `diff`

```elixir
@spec diff(t(), t()) :: t()
```

# `from_cpu_snapshots`

```elixir
@spec from_cpu_snapshots([cpu_snapshot_t()]) :: t()
```

Converts list of `cpu_snapshot_t` to ` Elixir.Beamchmark.Suite.Measurements.CpuInfo.t()`
By calculating the average

---

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