jhawthorn / vernier

📏 next generation CRuby profiler
https://vernier.prof/
MIT License
806 stars 17 forks source link

Log GC events and eagerly initialize initial thread #7

Closed tenderlove closed 1 year ago

tenderlove commented 1 year ago

This PR has two commits:

  1. Record the boot thread state: we should initialize threads with the thread that started Vernier
  2. Record GC events

I configured this to use Tracepoint events. The downside is that it looks like any GC related tracepoint events will cause the GC to do slowpath allocations.

In the allocator, this conditional determines if we should do a slowpath allocation. That macro simply looks at has_hook on objspace. It looks like that boolean will get set to true for any GC event, not just object allocation events.

Here are the GC lifecycle events and the corresponding mask

That said, I still think we should use the tracepoint events.

  1. The tracepoint events are more accurate than trying to inquire the state of the GC (like stackprof does)
  2. I think we can fix Ruby to use fastpath allocations even if the GC lifecycle events are on