Slide 14
Slide 14 text
Collect metrics in detail
Agent.collectMetics > Agent.generateValues
> Generate (cpuusage.go)
func (g *CpuusageGenerator) collectProcStatValues() ([]float64,
float64, uint, error) {
file, err := os.Open("/proc/stat")
func (g *CpuusageGenerator) Generate() (metrics.Values, error)
{
prevValues, prevTotal, _, err := g.collectProcStatValues()
$ cat /proc/stat
cpu 7792253 5479 4851396 18056319678 127239 0 146818 2383839
cpu0 5385397 1412 1970781 4509432750 103260 0 136689 876389