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

runtime/pprof: Documentation of SetCPUProfileRate #21243

Closed
tpudlik opened this issue Jul 31, 2017 · 1 comment
Closed

runtime/pprof: Documentation of SetCPUProfileRate #21243

tpudlik opened this issue Jul 31, 2017 · 1 comment

Comments

@tpudlik
Copy link

tpudlik commented Jul 31, 2017

The docstring for SetCPUProfileRate states,

Most clients should use the runtime/pprof package or the testing package's -test.cpuprofile flag instead of calling SetCPUProfileRate directly.

However, the -test.cpuprofile flag does not allow you to set the CPU profile rate, only the name of the file to which the profile should be written out to. The sentence quoted above should probably be removed.

@ianlancetaylor
Copy link
Contributor

The docs are correct. Although the testing package's -test.cpuprofile flag is not a complete replacement for runtime.SetCPUProfileRate, it does essentially call the function with a fixed value, namely 100. So we are recommending that people use -test.cpuprofile rather than write their code to call runtime.SetCPUProfileRate.

Note that the same is true of the runtime/pprof package that is also mentioned: it calls runtime.SetCPUProfileRate, but always passes either 100 or 0.

Closing because there is nothing to do.

@golang golang locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants