mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Implemented cpu stats
This commit is contained in:
@@ -150,6 +150,7 @@ func (e *UniversalExecutor) Stats() (*cstructs.TaskResourceUsage, error) {
|
||||
}
|
||||
|
||||
// CPU Related Stats
|
||||
totalProcessCPUUsage := stats.CpuStats.CpuUsage.TotalUsage
|
||||
userModeTime := stats.CpuStats.CpuUsage.UsageInUsermode
|
||||
kernelModeTime := stats.CpuStats.CpuUsage.UsageInKernelmode
|
||||
|
||||
@@ -162,6 +163,9 @@ func (e *UniversalExecutor) Stats() (*cstructs.TaskResourceUsage, error) {
|
||||
ThrottledPeriods: stats.CpuStats.ThrottlingData.ThrottledPeriods,
|
||||
ThrottledTime: stats.CpuStats.ThrottlingData.ThrottledTime,
|
||||
}
|
||||
if e.cpuStats != nil {
|
||||
cs.Percent = e.cpuStats.Percent(totalProcessCPUUsage)
|
||||
}
|
||||
return &cstructs.TaskResourceUsage{MemoryStats: ms, CpuStats: cs, Timestamp: time.Now()}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user