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 want to profile and `pprof.StopCPUProfile()` immediately after 
that section.

4. **Stop Profiling**: Ensure you call `defer pprof.StopCPUProfile()` to 
stop profiling and flush data when the function exits[2][3][4].

Hi Scott. Thanks for replying.

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.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/e21aad0f-04f9-4740-8ce7-34afaa65d17dn%40googlegroups.com.

Reply via email to