CPU Time - cgroup

What it does

This metric provider reads time spent in the CPU based on the cgroups stats file for all your cgroups. More information about cgroups can be found here.

Classname

  • CpuTimeCgroupProvider

Input Parameters

  • args
    • -i: interval in milliseconds

By default the measurement interval is 100 ms.

> ./metric-provider-binary -i 100 

Output

This metric provider prints to Stdout a continuous stream of data. The format of the data is as follows:

TIMESTAMP READING CONTAINER-ID

Where:

  • TIMESTAMP: Unix timestamp, in microseconds
  • READING:The time spent, in microseconds, by this container in the CPU

Any errors are printed to Stderr.

How it works

The provider assumes that you have cgroups v2 enabled on your system

The provider reads from the /sys/fs/cgroup/cpu.stat file.

In order to work in rootless cgroup delegation must be enabled here: /etc/systemd/system/[email protected]/delegate.conf

Currently, <USER-ID> is set to the calling user.