Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu time off by a factor of 40x on M1 Macs #168

Open
andreimatei opened this issue Mar 13, 2023 · 0 comments
Open

cpu time off by a factor of 40x on M1 Macs #168

andreimatei opened this issue Mar 13, 2023 · 0 comments

Comments

@andreimatei
Copy link

I believe ProcTime.Get is broken on M1 (and probably M2) Macs.
It does

	self.User = uint64(info.ptinfo.pti_total_user) / uint64(time.Millisecond)

but, on Darwin, pti_total_user needs to be scaled up by a factor of 125/3 because it is not expressed in nanos, but in "mach ticks" (I believe these ticks used to be nanos on Intel Macs). See https://developer.apple.com/documentation/driverkit/3433733-mach_timebase_info.

For reference, this is how htop does it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant