Fix pointer dereference for stats

This commit is contained in:
Alex Dadgar
2017-02-25 13:36:23 -08:00
parent 4961f5f67a
commit e8e3bbeada

View File

@@ -417,7 +417,7 @@ func (c *AllocStatusCommand) outputTaskResources(alloc *api.Allocation, task str
if stats != nil {
if ru, ok := stats.Tasks[task]; ok && ru != nil && ru.ResourceUsage != nil {
if cs := ru.ResourceUsage.CpuStats; cs != nil {
cpuUsage = fmt.Sprintf("%v/%v", math.Floor(cs.TotalTicks), resource.CPU)
cpuUsage = fmt.Sprintf("%v/%v", math.Floor(cs.TotalTicks), cpuUsage)
}
if ms := ru.ResourceUsage.MemoryStats; ms != nil {
memUsage = fmt.Sprintf("%v/%v", humanize.IBytes(ms.RSS), memUsage)