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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
tklauser
force-pushed
the
drop-getconf
branch
from
February 19, 2021 11:20
93c8cb1
to
ee12f66
Compare
I read your code and this library is great, and the license is BSD. Thank you! I add your awesome library with big appreciate. |
This was referenced Mar 8, 2021
This was referenced Mar 15, 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently,
ClocksPerSec
is determined byexec
'inggetconf
infunc init
,i.e. on startup of every program importing the package.
getconf
mightnot 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 implementssysconf(3)
entirely in Go without cgo. The package is supported on all platforms
currently supported by the
cpu
andv3/cpu
package of gopsutil.