-
Notifications
You must be signed in to change notification settings - Fork 122
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
Timing profiling? #58
Comments
The CPU profile is the one to start with. If you are using linux you might also find the perf tool (comes with your linux disto, not this project) useful |
@davecheney Thanks for the quick reply. :-) Does the |
If you are using cpu profiling in a go test, support for generating a profile is built into the go test runner, use go test -cpuprofile=c.p |
Sorry. I’m not understanding what you are saying. Let me simplify. I have a project with multiple Go files and I want to know how much time The application spends in each function. Can I do that with this package and, if so, how? |
I think if you want to profile how much time is spent in the various parts of the program over time, start a profile at the top of main, run your program under the expected load, then control c it and investigate the profile. if you want to micro benchmark a particular function, write a go benchmark for that function the you can use the go test -cpuprofile flag to obtain a profile of the function under test |
That's curious. Most profiling tools I have used allow One to run the application as a whole, perhaps with some additional aspects in order to provide the requisite functionality, and produce that information at the end. Oh, well. |
This package lets you turn on profiling for a section of time then emit a profile. The defer start().stop() example is just that, an example. You could do something like this func main() { func application() { |
Hi. I hope everyone is having a great new year so far.
I was told by a colleague I could use this package for determining how much time is being spent in each function during an application's run. Is this correct and, if so, how? I saw nothing in the documentation which makes this clear if so.
Thanks in advance.
The text was updated successfully, but these errors were encountered: