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

MacOS thread times are incorrect since they only consider microseconds #1278

Closed
nikhilm opened this issue May 14, 2018 · 3 comments · Fixed by #1292
Closed

MacOS thread times are incorrect since they only consider microseconds #1278

nikhilm opened this issue May 14, 2018 · 3 comments · Fixed by #1292
Labels

Comments

@nikhilm
Copy link
Contributor

nikhilm commented May 14, 2018

On MacOS, psutil uses only the microseconds field here https://github.com/giampaolo/psutil/blob/master/psutil/_psutil_osx.c#L1072.

The struct also has a seconds field, which should be added to the return value.

@giampaolo
Copy link
Owner

It's too specific and only OSX has it. I prefer not to.

@nikhilm
Copy link
Contributor Author

nikhilm commented May 14, 2018

I don't understand why this was closed. The threads() function is supported on all platforms, but on MacOS it is returning incorrect values for the thread run times. The issue is in the file specific to MacOS so it doesn't need to be platform independent.

This issue is a request to fix that by returning

basic_info_th->user_time.seconds + (float)basic_info_th->user_time.microseconds / 1000000.0,

instead of

 (float)basic_info_th->user_time.microseconds / 1000000.0,

and similar for the system time.

@giampaolo
Copy link
Owner

Oh, sorry, I thought the request was to add "microseconds" as a new field for the returned namedtuple.

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

Successfully merging a pull request may close this issue.

2 participants