rubyatscale / singed

Get a flamegraph anywhere in your code base. Powered by stackprof, rbspy, and speedscope
MIT License
408 stars 9 forks source link

Add `start` and `stop` methods for when code isn't conveniently block wrappable #1

Open technicalpickles opened 1 year ago

technicalpickles commented 1 year ago

stackprof supports using start / stop in addition to the block usage. This is helpful for when things aren't cleanly block wrapped.

cc @baweaver who requested it

nate-at-gusto commented 1 year ago

This would help profiling Rails boot too

technicalpickles commented 1 year ago

@nate-at-gusto how are you thinking you'd use it in that case? I've been using the CLI to do this (with rbspy under the hood)

nate-at-gusto commented 1 year ago

Add Singed.start to boot.rb, bin/rails runner 'Singed.stop'

technicalpickles commented 1 year ago

I can see the value in this now. I have been using memory_profiler recently, and have used things like at_exit hooks to stop and generate the report. I could see doing the same with singed.