func (mc MetricCPU) Update(scpu sigar.Cpu) { totalDelta := mc.Total.UpdateAbsolute(int64(scpu.Total())) mc.User.UpdatePercent(totalDelta, scpu.User) mc.Nice.UpdatePercent(totalDelta, scpu.Nice) mc.Sys.UpdatePercent(totalDelta, scpu.Sys) mc.Idle.UpdatePercent(totalDelta, scpu.Idle) if mc.Extra != nil { mc.Extra.UpdateCPU(scpu, totalDelta) } }
// AddSCPU adds other to dst field by field. func AddSCPU(dst *sigar.Cpu, other sigar.Cpu) { dst.User += other.User dst.Nice += other.Nice dst.Sys += other.Sys dst.Idle += other.Idle dst.Wait += other.Wait dst.Irq += other.Irq dst.SoftIrq += other.SoftIrq dst.Stolen += other.Stolen }