Skip to content

Commit

Permalink
Merge pull request #1084 from helen-frank/feature/crictlStatsAddName
Browse files Browse the repository at this point in the history
crictl stats add name row
  • Loading branch information
k8s-ci-robot authored Feb 8, 2023
2 parents a70af44 + fda6d7f commit 0953707
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/crictl/container_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,13 @@ func displayStats(ctx context.Context, client internalapi.RuntimeService, reques
return err
}

display.AddRow([]string{columnContainer, columnCPU, columnMemory, columnDisk, columnInodes})
display.AddRow([]string{columnContainer, columnName, columnCPU, columnMemory, columnDisk, columnInodes})
for _, s := range r.GetStats() {
if ctx.Err() != nil {
return ctx.Err()
}
id := getTruncatedID(s.Attributes.Id, "")
name := s.GetAttributes().GetMetadata().GetName()
cpu := s.GetCpu().GetUsageCoreNanoSeconds().GetValue()
mem := s.GetMemory().GetWorkingSetBytes().GetValue()
disk := s.GetWritableLayer().GetUsedBytes().GetValue()
Expand All @@ -245,7 +246,7 @@ func displayStats(ctx context.Context, client internalapi.RuntimeService, reques
}
cpuPerc = float64(cpu-old.GetCpu().GetUsageCoreNanoSeconds().GetValue()) / float64(duration) * 100
}
display.AddRow([]string{id, fmt.Sprintf("%.2f", cpuPerc), units.HumanSize(float64(mem)),
display.AddRow([]string{id, name, fmt.Sprintf("%.2f", cpuPerc), units.HumanSize(float64(mem)),
units.HumanSize(float64(disk)), fmt.Sprintf("%d", inodes)})

}
Expand Down

0 comments on commit 0953707

Please sign in to comment.