go-sysinfo icon indicating copy to clipboard operation
go-sysinfo copied to clipboard

macOS ARM - Incorrect process CPU times

Open andrewkroh opened this issue 2 years ago • 2 comments

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 avatar Mar 21 '23 02:03 andrewkroh

@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.

nickelnickel avatar Dec 28 '23 19:12 nickelnickel

I'm not aware of any teams that have this on their plan at the moment. Contributions are welcomed.

andrewkroh avatar Jan 03 '24 22:01 andrewkroh