Re: [go-nuts] Re: runtime/pprof - pausing CPU profiling

2024-11-13 Thread Rhys Hiltner
There are a few options for post-processing, all within the set of supported Go APIs. One is to use the `-focus` flag of `go tool pprof` so it only displays samples that match a particular call stack. If the code to be profiled is in a single function, that might be all you need. Another is to set

Re: [go-nuts] Re: runtime/pprof - pausing CPU profiling

2024-11-13 Thread Ian Lance Taylor
On Wed, Nov 13, 2024, 5:31 AM Jason E. Aten wrote: > All good. I still think that the hack of blocking and restoring the > runtime's SIGPROF signal > handler might actually work though. It might not work. But if it does, it > is almost > exactly what you were looking for. > > Ian or others more

Re: [go-nuts] Re: runtime/pprof - pausing CPU profiling

2024-11-13 Thread Jason E. Aten
(On gopherslack, the #darkarts folks are performance oriented) On Wed, Nov 13, 2024 at 1:30 PM Jason E. Aten wrote: > All good. I still think that the hack of blocking and restoring the > runtime's SIGPROF signal > handler might actually work though. It might not work. But if it does, it >

Re: [go-nuts] Re: runtime/pprof - pausing CPU profiling

2024-11-13 Thread Jason E. Aten
All good. I still think that the hack of blocking and restoring the runtime's SIGPROF signal handler might actually work though. It might not work. But if it does, it is almost exactly what you were looking for. Ian or others more knowledgeable myself might be able to advise better if it _should_

Re: [go-nuts] Re: runtime/pprof - pausing CPU profiling

2024-11-13 Thread Stephen Illingworth
On Wednesday 13 November 2024 at 12:02:12 UTC Jason E. Aten wrote: > I've tried but this unfortunately, the Start and Stop processes are too expensive and really require writing to a different file for every stop. The nature of the program means I need to do the Start/Stop process 60+ times per

Re: [go-nuts] Re: runtime/pprof - pausing CPU profiling

2024-11-13 Thread Jason E. Aten
> I've tried but this unfortunately, the Start and Stop processes are too expensive and really require writing to a different file for every stop. The nature of the program means I need to do the Start/Stop process 60+ times per second, so it would generate a lot of files and be very slow on top.

[go-nuts] Re: runtime/pprof - pausing CPU profiling

2024-11-13 Thread Stephen Illingworth
Thank's Jason. These are all good ideas: On Wednesday 13 November 2024 at 02:06:56 UTC Jason E. Aten wrote: Idea 0: Can you just click on the graphviz boxes in the pprof http page for your section and then just show the source for only those? Might give you a quick idea of which are the hottest

Re: [go-nuts] Re: runtime/pprof - pausing CPU profiling

2024-11-13 Thread Stephen Illingworth
On Wednesday 13 November 2024 at 06:05:36 UTC scott beeker wrote: 2. **Start Profiling**: Use `pprof.StartCPUProfile(file)` to start profiling, where `file` is an `os.File` object to write the profile data. 3. **Restrict Profiling**: Place `pprof.StartCPUProfile()` before the code section you w

Re: [go-nuts] Re: runtime/pprof - pausing CPU profiling

2024-11-12 Thread scott beeker
create a runtime CPU profile but to restrict the profile to a specific part of the program. runtime/pprof - pausing CPU profiling To create a runtime CPU profile for a specific part of a Go program, you can use the `runtime/pprof` package. Here's how you can do it: 1. **Import the Package**: Add

[go-nuts] Re: runtime/pprof - pausing CPU profiling

2024-11-12 Thread Jason E. Aten
Idea 0: Can you just click on the graphviz boxes in the pprof http page for your section and then just show the source for only those? Might give you a quick idea of which are the hottest spots only among those func of interest. Idea 1: Can you write a test or benchmark that just exercises the i