calcCpuLoad :: CpuStat -> CpuStat -> CpuStat -> Int
calcCpuLoad p a b = ((totalAll p a b - idleAll p a b) * 100) `div` totalAll p a b
  where
    idle c = cpuIdle c + cpuIOWait c
    nonIdle c = cpuUser c + cpuNice c + cpuSystem c + cpuIRQ c + cpuSoftIRQ c + cpuSteal c
    total c = idle c + nonIdle c
    totalAll p a b = total b - (total a + total p) `div` 2
    idleAll p a b  = idle b - (idle a + idle p) `div` 2
calcCpuLoad :: CpuStat -> CpuStat -> CpuStat -> Int
calcCpuLoad p a b = ((totalAll p a b - idleAll p a b) * 100) `div` totalAll p a b
  where
    idle c = cpuIdle c + cpuIOWait c
    nonIdle c = cpuUser c + cpuNice c + cpuSystem c + cpuIRQ c + cpuSoftIRQ c + cpuSteal c
    total c = idle c + nonIdle c
    totalAll p a b = total b - (total a + total p) `div` 2
    idleAll p a b  = idle b - (idle a + idle p) `div` 2
calcCpuLoad p a b = ((totalAll p a b - idleAll p a b) * 100) `div` totalAll p a b
  where
    idle c = cpuIdle c + cpuIOWait c
    nonIdle c = cpuUser c + cpuNice c + cpuSystem c + cpuIRQ c + cpuSoftIRQ c + cpuSteal c
    total c = idle c + nonIdle c
    totalAll p a b = total b - (total a + total p) `div` 2
    idleAll p a b  = idle b - (idle a + idle p) `div` 2