go-sysinfo
go-sysinfo copied to clipboard
macOS ARM - Incorrect process CPU times
Based on similar code in other projects it looks like the process CPU times may not be scaled correctly on Apple M1 / M2 hardware. This code needs to apply a scaling factor from https://developer.apple.com/documentation/driverkit/mach_timebase_info_t to the ticks. Under intel macs these were simple 1 tick = 1 nanosecond so it just worked.
https://github.com/elastic/go-sysinfo/blob/f544eca983fbc8de1d9f479ba18628dbcebb3e87/providers/darwin/process_darwin.go#L155-L156
Related
- https://openradar.appspot.com/radar?id=5055988478509056
- https://github.com/elastic/gosigar/issues/168
- https://github.com/elastic/elastic-agent-system-metrics/issues/79
@andrewkroh do you know if there is a plan to address this issue? As noted in https://github.com/elastic/gosigar/issues/168 we have confirmed this is affecting measurements by our product which relies on this for CPU measurements.
I'm not aware of any teams that have this on their plan at the moment. Contributions are welcomed.