beltex / SystemKit

macOS system library in Swift
MIT License
351 stars 65 forks source link

Result of usageCPU doesn't update #33

Closed getangar closed 5 years ago

getangar commented 5 years ago

Hi there, it looks that the result of a call to the usageCPU doesn't update the returned values. This my my fragment of code (99% identical to the documentation):

    var sys = System()
    let cpuUsage = sys.usageCPU()

    cpuUsageSystem.stringValue =  "\(Int(cpuUsage.system))%"
    cpuUsageUser.stringValue =  "\(Int(cpuUsage.user))%"
    cpuUsageIdle.stringValue =  "\(Int(cpuUsage.idle))%"
    cpuUsageNice.stringValue = "\(Int(cpuUsage.nice))%"