Gather per-process CPU and memory metrics.

This commit is contained in:
Tom Wilkie
2015-12-14 17:33:54 +00:00
parent bc8f86a75f
commit caff695f96
15 changed files with 172 additions and 81 deletions

View File

@@ -327,6 +327,18 @@ func processOriginTable(nmd report.Node, addHostTag bool, addContainerTag bool)
rows = append([]Row{{Key: "Host", ValueMajor: report.ExtractHostID(nmd)}}, rows...)
}
for _, tuple := range []struct {
key, human string
fmt formatter
}{
{process.CPUUsage, "CPU Usage", formatPercent},
{process.MemoryUsage, "Memory Usage", formatMemory},
} {
if val, ok := nmd.Metrics[tuple.key]; ok {
rows = append(rows, sparklineRow(tuple.human, val, tuple.fmt))
}
}
var (
title = "Process"
name, commFound = nmd.Metadata[process.Comm]