cputime 표기방식 바꿈
This commit is contained in:
parent
505d6b8332
commit
9f8fed3b85
|
@ -39,6 +39,7 @@ type LoadInfo struct {
|
|||
Avg15 float64 `json:"avg_15"`
|
||||
}
|
||||
type CPUInfo struct {
|
||||
Total float64 `json:"total"`
|
||||
Idle float64 `json:"idle"`
|
||||
Nice float64 `json:"nice"`
|
||||
System float64 `json:"system"`
|
||||
|
@ -303,15 +304,12 @@ func (p *osMetric) readCpuStat(info *OSMetricInfo, errChan chan<- error, waiter
|
|||
p.logger.Debugf("readCpuStat: system=%d", ct.System)
|
||||
p.logger.Debugf("readCpuStat: total=%d", ct.Total)
|
||||
p.logger.Debugf("readCpuStat: user=%d", ct.User)
|
||||
p.logger.Debugf("readCpuStat: idle=%f%%", float64(ct.Idle*100)/float64(ct.Total))
|
||||
p.logger.Debugf("readCpuStat: nice=%f%%", float64(ct.Nice*100)/float64(ct.Total))
|
||||
p.logger.Debugf("readCpuStat: system=%f%%", float64(ct.System*100)/float64(ct.Total))
|
||||
p.logger.Debugf("readCpuStat: user=%f%%", float64(ct.User*100)/float64(ct.Total))
|
||||
|
||||
info.CPU.Idle = float64(ct.Idle*100) / float64(ct.Total)
|
||||
info.CPU.Nice = float64(ct.Nice*100) / float64(ct.Total)
|
||||
info.CPU.System = float64(ct.System*100) / float64(ct.Total)
|
||||
info.CPU.User = float64(ct.User*100) / float64(ct.Total)
|
||||
info.CPU.Total = float64(ct.Total)
|
||||
info.CPU.Idle = float64(ct.Idle)
|
||||
info.CPU.Nice = float64(ct.Nice)
|
||||
info.CPU.System = float64(ct.System)
|
||||
info.CPU.User = float64(ct.User)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ type LoadInfo struct {
|
|||
}
|
||||
|
||||
type CPUInfo struct {
|
||||
Total float64 `json:"total"`
|
||||
User float64 `json:"user"`
|
||||
Nice float64 `json:"nice"`
|
||||
System float64 `json:"system"`
|
||||
|
@ -361,14 +362,15 @@ func (p *osMetric) readCpuStat(info *OSMetricInfo, errChan chan<- error, waiter
|
|||
p.logger.Debugf("cpu softirq: %f%%", float64(ct.Softirq*100)/float64(ct.Total))
|
||||
p.logger.Debugf("cpu steal: %f%%", float64(ct.Steal*100)/float64(ct.Total))
|
||||
|
||||
info.CPU.User = float64(ct.User*100) / float64(ct.Total)
|
||||
info.CPU.Nice = float64(ct.Nice*100) / float64(ct.Total)
|
||||
info.CPU.System = float64(ct.System*100) / float64(ct.Total)
|
||||
info.CPU.Idle = float64(ct.Idle*100) / float64(ct.Total)
|
||||
info.CPU.Iowait = float64(ct.Iowait*100) / float64(ct.Total)
|
||||
info.CPU.Irq = float64(ct.Irq*100) / float64(ct.Total)
|
||||
info.CPU.Softirq = float64(ct.Softirq*100) / float64(ct.Total)
|
||||
info.CPU.Steal = float64(ct.Steal*100) / float64(ct.Total)
|
||||
info.CPU.Total = float64(ct.Total)
|
||||
info.CPU.User = float64(ct.User)
|
||||
info.CPU.Nice = float64(ct.Nice)
|
||||
info.CPU.System = float64(ct.System)
|
||||
info.CPU.Idle = float64(ct.Idle)
|
||||
info.CPU.Iowait = float64(ct.Iowait)
|
||||
info.CPU.Irq = float64(ct.Irq)
|
||||
info.CPU.Softirq = float64(ct.Softirq)
|
||||
info.CPU.Steal = float64(ct.Steal)
|
||||
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue