Merge pull request #34 from bernerdschaefer/cgroup-stats-total-cpu-usage
CpuStats.CpuUsage includes TotalUsage
This commit is contained in:
commit
3acf21b60e
|
@ -84,6 +84,7 @@ func (s *cpuacctGroup) GetStats(d *data, stats *cgroups.Stats) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
stats.CpuStats.CpuUsage.TotalUsage = lastUsage
|
||||||
stats.CpuStats.CpuUsage.PercpuUsage = percpuUsage
|
stats.CpuStats.CpuUsage.PercpuUsage = percpuUsage
|
||||||
stats.CpuStats.CpuUsage.UsageInKernelmode = (kernelModeUsage * nanosecondsInSecond) / clockTicks
|
stats.CpuStats.CpuUsage.UsageInKernelmode = (kernelModeUsage * nanosecondsInSecond) / clockTicks
|
||||||
stats.CpuStats.CpuUsage.UsageInUsermode = (userModeUsage * nanosecondsInSecond) / clockTicks
|
stats.CpuStats.CpuUsage.UsageInUsermode = (userModeUsage * nanosecondsInSecond) / clockTicks
|
||||||
|
|
|
@ -14,6 +14,8 @@ type CpuUsage struct {
|
||||||
PercentUsage uint64 `json:"percent_usage,omitempty"`
|
PercentUsage uint64 `json:"percent_usage,omitempty"`
|
||||||
// nanoseconds of cpu time consumed over the last 100 ms.
|
// nanoseconds of cpu time consumed over the last 100 ms.
|
||||||
CurrentUsage uint64 `json:"current_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"`
|
PercpuUsage []uint64 `json:"percpu_usage,omitempty"`
|
||||||
// Time spent by tasks of the cgroup in kernel mode. Units: nanoseconds.
|
// Time spent by tasks of the cgroup in kernel mode. Units: nanoseconds.
|
||||||
UsageInKernelmode uint64 `json:"usage_in_kernelmode"`
|
UsageInKernelmode uint64 `json:"usage_in_kernelmode"`
|
||||||
|
|
Loading…
Reference in New Issue