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, v3/cpu: use sysconf package instead of exec'ing getconf #1036

Merged
merged 1 commit into from Feb 20, 2021

Conversation

tklauser
Copy link
Contributor

Currently, ClocksPerSec is determined by exec'ing getconf in func init,
i.e. on startup of every program importing the package. getconf might
not be present on some systems or is not executable by the current user.
To avoid this hard to control dependency, use the
github.com/tklauser/go-sysconf package which implements sysconf(3)
entirely in Go without cgo. The package is supported on all platforms
currently supported by the cpu and v3/cpu package of gopsutil.

Currently, ClocksPerSec is determined by exec'ing getconf in func init,
i.e. on startup of every program importing the package. getconf might
not be present on some systems or is not executable by the current user.
To avoid this hard to control dependency, use the
github.com/tklauser/go-sysconf package which implements sysconf(3)
entirely in Go without cgo. The package is supported on all platforms
currently supported by the cpu and v3/cpu package of gopsutil.
@shirou
Copy link
Owner

shirou commented Feb 20, 2021

I read your code and this library is great, and the license is BSD. Thank you! I add your awesome library with big appreciate.

@shirou shirou merged commit a346c31 into shirou:master Feb 20, 2021
@tklauser tklauser deleted the drop-getconf branch February 20, 2021 16:57
This was referenced Mar 8, 2021
tklauser added a commit to tklauser/gopsutil that referenced this pull request Jun 2, 2021
…ing clock ticks

The github.com/tklauser/go-sysconf is already a dependency used in the
cpu and v3/cpu packages to determine clock ticks using
`sysconf.Sysconf(sysconf.SC_CLK_TCK)`, see shirou#1036. Use the same in packages
process and v3/process as well instead of hard-coding clock ticks to
100.
tklauser added a commit to tklauser/gopsutil that referenced this pull request Jun 2, 2021
…ing clock ticks

The github.com/tklauser/go-sysconf package is already a dependency used
in the cpu and v3/cpu packages to determine clock ticks using
`sysconf.Sysconf(sysconf.SC_CLK_TCK)`, see shirou#1036. Use the same in
packages process and v3/process as well instead of hard-coding clock
ticks to 100.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants