(first CPUSample, second CPUSample)
| 181 | } |
| 182 | |
| 183 | func getCPUAverage(first CPUSample, second CPUSample) (avg CPUAverage) { |
| 184 | dTot := float64(second.Total - first.Total) |
| 185 | invQuotient := 100.00 / dTot |
| 186 | |
| 187 | avg.UserPct = subtractAndConvertTicks(second.User, first.User) * invQuotient |
| 188 | avg.NicePct = subtractAndConvertTicks(second.Nice, first.Nice) * invQuotient |
| 189 | avg.SystemPct = subtractAndConvertTicks(second.System, first.System) * invQuotient |
| 190 | avg.IdlePct = subtractAndConvertTicks(second.Idle, first.Idle) * invQuotient |
| 191 | avg.IowaitPct = subtractAndConvertTicks(second.Iowait, first.Iowait) * invQuotient |
| 192 | avg.IrqPct = subtractAndConvertTicks(second.Irq, first.Irq) * invQuotient |
| 193 | avg.SoftIrqPct = subtractAndConvertTicks(second.SoftIrq, first.SoftIrq) * invQuotient |
| 194 | avg.StealPct = subtractAndConvertTicks(second.Steal, first.Steal) * invQuotient |
| 195 | avg.GuestPct = subtractAndConvertTicks(second.Guest, first.Guest) * invQuotient |
| 196 | avg.Time = second.Time |
| 197 | avg.Seconds = second.Time.Sub(first.Time).Seconds() |
| 198 | return |
| 199 | } |
| 200 | |
| 201 | func getProcCPUAverage(first ProcCPUSample, second ProcCPUSample, procUptime float64) (avg ProcCPUAverage) { |
| 202 | dT := second.Time.Sub(first.Time).Seconds() |
no test coverage detected