Open ghost opened 11 years ago
It's a number of "events", that loosely correlates to number of method calls. It depends on the exact version of ruby and VM optimizations enabled.
The same events as in Kernel#set_trace_func?
Briefly looking at the code it looks like we could increase the counter in profiler_hook
instead of stackframe_record
, which is called for every event. Once per "stack frame entry", which seems to more closely correlate to method calls.
Giving it a try.
Nevermind that idea, it's effectively the same as how it works now.
I came up with lgierth/rblineprof@6517ddc, it's supposed to skip the frame if its file and line equal the previous frame's file and line. Doesn't work yet, but I'll figure it out - my first C steps!
I got the following result from 100 iterations of the method and I'm wondering how rblineprof comes up with these counts.
In the first three lines of
self.build
, it seems to count the number of method calls, but from then on I have no idea. Might there be a problem with Fibers? Each of the iterations was running in its own Fiber, with roughly 10 running concurrently - although clearly none should have been interrupted (Promise.new
doesn't yield either).Edit: the actual code is on its way...