pprof-rs
pprof-rs copied to clipboard
Dont panic for 0 frequence
Make 0 frequency a valid option.
Thanks for your contribution :beers:.
If the interval is 0, the timer is stopped. I don't think it's intuitive for users. Could we return the error to the user?
Actually, panic is not that bad :thinking:. Could you give more explanation on why you want to avoid the panic?
Hi @YangKeao, yes I can give you the scenario where this found me, I have integrated pprof-rs to an application I'm writing, so first of all thank it's a great crate and it helped find some nice places that required additional optimizations.
As for the scenario, the application I'm writing has a server listening thread which accepts commands, for example one of the command is to start the profiling.
I have added another command which collects the backtraces of all the threads in the application using your crate, basically what I do is set the frequency to 0, and then tkill I can send a SIGPROF to each thread, once I'm done sending the SIGPROF to each thread I collect the backtraces from the Profiler.
I thought about contributing that piece of code as well but it's very platform specific (only Linux) and it's not really a profiling scenario.
Thanks, -- Jon.