Skip to content

Renamed variables storing CLK_TCK value for consistency across OSs #870

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

Merged
merged 1 commit into from
May 31, 2020

Conversation

renaynay
Copy link
Contributor

This PR renames the variables holding the value of CLK_TCK across all OSs for consistency. ClocksPerSec is used for darwin, openbsd, freebsd and solaris, but other names are used for linux and windows. It would be helpful to rename the variable so that it is consistent across all supported platforms.

@Lomanic
Copy link
Collaborator

Lomanic commented May 12, 2020

These variables shouldn't have been exported in the first place, they are only needed internally by the package for stats calculation. Do you need them? I read in ethereum/go-ethereum#21041 that our docs may be wrong, optimally we should align on psutil's and return the same values, if that's not the case I would prefer fixing this this way (fix docs and returned values).

@renaynay
Copy link
Contributor Author

@Lomanic I've created a separate PR to update the docs for TimesStat. Hopefully this mitigates some of the misunderstanding.

The current implementation of TimesStat in gopsutil is aligned with psutil's, as the documentation for psutil points out that every attribute (of cpu_times) represents the seconds the CPU has spent in the given mode.

@Lomanic
Copy link
Collaborator

Lomanic commented May 13, 2020

Thanks for your quick reply, it clears things up and thanks for opening this PR to improve the docs. Still remains the fact that these variables shouldn't be exported to end-users because it's only a lib internal (they should be unexported instead), do you have usage for these variables?

@renaynay
Copy link
Contributor Author

Yes, we still have a usage for these variables as we'd like to continue returning the cpu ticks, so it would be nice to be able to pull the ClocksPerSec value from this lib. We feel it makes sense to make it part of the public psutil interface, since it is a system-wide parameter that we would otherwise need to get through other means.

@renaynay
Copy link
Contributor Author

Hey @Lomanic , do you have any other comment on this? Just following up and checking in on the status.

@Lomanic Lomanic merged commit a901d16 into shirou:master May 31, 2020
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

Successfully merging this pull request may close these issues.

2 participants