1
0
Fork 0

cputime 표기방식 바꿈

This commit is contained in:
Sangbum Kim 2018-07-14 01:57:27 +09:00
parent 505d6b8332
commit 9f8fed3b85
2 changed files with 55 additions and 55 deletions

View File

@ -39,6 +39,7 @@ type LoadInfo struct {
Avg15 float64 `json:"avg_15"` Avg15 float64 `json:"avg_15"`
} }
type CPUInfo struct { type CPUInfo struct {
Total float64 `json:"total"`
Idle float64 `json:"idle"` Idle float64 `json:"idle"`
Nice float64 `json:"nice"` Nice float64 `json:"nice"`
System float64 `json:"system"` 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: system=%d", ct.System)
p.logger.Debugf("readCpuStat: total=%d", ct.Total) p.logger.Debugf("readCpuStat: total=%d", ct.Total)
p.logger.Debugf("readCpuStat: user=%d", ct.User) 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.Total = float64(ct.Total)
info.CPU.Nice = float64(ct.Nice*100) / float64(ct.Total) info.CPU.Idle = float64(ct.Idle)
info.CPU.System = float64(ct.System*100) / float64(ct.Total) info.CPU.Nice = float64(ct.Nice)
info.CPU.User = float64(ct.User*100) / float64(ct.Total) info.CPU.System = float64(ct.System)
info.CPU.User = float64(ct.User)
return return
} }

View File

@ -48,6 +48,7 @@ type LoadInfo struct {
} }
type CPUInfo struct { type CPUInfo struct {
Total float64 `json:"total"`
User float64 `json:"user"` User float64 `json:"user"`
Nice float64 `json:"nice"` Nice float64 `json:"nice"`
System float64 `json:"system"` 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 softirq: %f%%", float64(ct.Softirq*100)/float64(ct.Total))
p.logger.Debugf("cpu steal: %f%%", float64(ct.Steal*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.Total = float64(ct.Total)
info.CPU.Nice = float64(ct.Nice*100) / float64(ct.Total) info.CPU.User = float64(ct.User)
info.CPU.System = float64(ct.System*100) / float64(ct.Total) info.CPU.Nice = float64(ct.Nice)
info.CPU.Idle = float64(ct.Idle*100) / float64(ct.Total) info.CPU.System = float64(ct.System)
info.CPU.Iowait = float64(ct.Iowait*100) / float64(ct.Total) info.CPU.Idle = float64(ct.Idle)
info.CPU.Irq = float64(ct.Irq*100) / float64(ct.Total) info.CPU.Iowait = float64(ct.Iowait)
info.CPU.Softirq = float64(ct.Softirq*100) / float64(ct.Total) info.CPU.Irq = float64(ct.Irq)
info.CPU.Steal = float64(ct.Steal*100) / float64(ct.Total) info.CPU.Softirq = float64(ct.Softirq)
info.CPU.Steal = float64(ct.Steal)
return return
} }