Skip to content

Commit

Permalink
CpuStats.CpuUsage includes TotalUsage
Browse files Browse the repository at this point in the history
Docker-DCO-1.1-Signed-off-by: Bernerd Schaefer <bj.schaefer@gmail.com> (github: bernerdschaefer)
  • Loading branch information
bernerdschaefer committed Jun 19, 2014
1 parent 2c29550 commit cc266ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions cgroups/fs/cpuacct.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func (s *cpuacctGroup) GetStats(d *data, stats *cgroups.Stats) error {
if err != nil {
return err
}
stats.CpuStats.CpuUsage.TotalUsage = lastUsage
stats.CpuStats.CpuUsage.PercpuUsage = percpuUsage
stats.CpuStats.CpuUsage.UsageInKernelmode = (kernelModeUsage * nanosecondsInSecond) / clockTicks
stats.CpuStats.CpuUsage.UsageInUsermode = (userModeUsage * nanosecondsInSecond) / clockTicks
Expand Down
6 changes: 4 additions & 2 deletions cgroups/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ type CpuUsage struct {
// percentage of available CPUs currently being used.
PercentUsage uint64 `json:"percent_usage,omitempty"`
// nanoseconds of cpu time consumed over the last 100 ms.
CurrentUsage uint64 `json:"current_usage,omitempty"`
PercpuUsage []uint64 `json:"percpu_usage,omitempty"`
CurrentUsage uint64 `json:"current_usage,omitempty"`
// total nanoseconds of cpu time consumed
TotalUsage uint64 `json:"total_usage,omitempty"`
PercpuUsage []uint64 `json:"percpu_usage,omitempty"`
// Time spent by tasks of the cgroup in kernel mode. Units: nanoseconds.
UsageInKernelmode uint64 `json:"usage_in_kernelmode"`
// Time spent by tasks of the cgroup in user mode. Units: nanoseconds.
Expand Down

0 comments on commit cc266ed

Please sign in to comment.