add percent helper method to metrics

This commit is contained in:
Bradley Cicenas
2017-06-10 13:00:54 +00:00
parent b49e174483
commit 389dee0f3c
5 changed files with 20 additions and 11 deletions

View File

@@ -95,7 +95,7 @@ func (c *Runc) ReadMem(stats *cgroups.Stats) {
if c.MemLimit > sysMemTotal && sysMemTotal > 0 {
c.MemLimit = sysMemTotal
}
c.MemPercent = round((float64(c.MemUsage) / float64(c.MemLimit)) * 100)
c.MemPercent = percent(float64(c.MemUsage), float64(c.MemLimit))
}
func (c *Runc) ReadNet(interfaces []*libcontainer.NetworkInterface) {