View Source Beamchmark.Suite.Measurements.CpuInfo (Beamchmark v1.4.0)

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

Link to this section Summary

Types

All information gathered via single snapshot + processor average

t()

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

Functions

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

Link to this section Types

Specs

cpu_snapshot_t() :: %{
  timestamp: pos_integer(),
  cpu_usage: %{
    required(core_id :: integer()) => usage :: Beamchmark.Math.percent_t()
  },
  average_all_cores: average_all_cores :: Beamchmark.Math.percent_t()
}

All information gathered via single snapshot + processor average

Specs

t() :: %Beamchmark.Suite.Measurements.CpuInfo{
  average_all: Beamchmark.Math.percent_t() | float(),
  average_by_core: %{
    required(core_id :: number()) =>
      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

Link to this section Functions

Specs

diff(t(), t()) :: t()
Link to this function

from_cpu_snapshots(cpu_snapshots)

View Source

Specs

from_cpu_snapshots([cpu_snapshot_t()]) :: t()

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