Propagate number of logical CPUs in resource usage

This commit is contained in:
Ingo Oppermann
2023-04-27 10:58:41 +02:00
parent c9bdaae7f7
commit b723f4e5fd
10 changed files with 86 additions and 10 deletions

View File

@@ -81,6 +81,7 @@ type Status struct {
Time time.Time // Time is the time of the last change of the state
CommandArgs []string // Currently running command arguments
CPU struct {
NCPU float64 // Number of logical CPUs
Current float64 // Currently consumed CPU in percent
Average float64 // Average consumed CPU in percent
Max float64 // Max. consumed CPU in percent
@@ -432,14 +433,10 @@ func (p *process) Status() Status {
Reconnect: time.Duration(-1),
Duration: time.Since(stateTime),
Time: stateTime,
CPU: usage.CPU,
Memory: usage.Memory,
}
s.CPU.Current = usage.CPU.Current
s.CPU.Average = usage.CPU.Average
s.CPU.Max = usage.CPU.Max
s.CPU.Limit = usage.CPU.Limit
s.CommandArgs = make([]string, len(p.args))
copy(s.CommandArgs, p.args)