Discussion:
using jit.attach and the profiler at the same time?
Elias Hogstvedt
2014-09-04 02:09:20 UTC
Permalink
I wrote a profiler for my project using the low level one included in
luajit. In addition to that I wrote something to show trace abort reasons
with jit.attach and then have it show why functions called the most
wouldn't compile.

Using these two together seems to often make the abort reason 0 (error
thrown or hook called during recording)

All I'm doing in callbacks is this:

---------------------------------------------------------------------------------------------

local function profiler_callback(thread, samples, vmstate)

local str = jit_profiler.dumpstack(thread, "pl\n", 10)

table.insert(profiler.raw_data.statistical, {str, samples})

end

local function trace_dump_callback(what, trace_id, func, pc,
trace_error_id, trace_error_arg)

if what == "abort" then

local info = jit_util.funcinfo(func, pc)

table.insert(profiler.raw_data.trace_aborts, {info, trace_error_id,
trace_error_arg})

end

end

---------------------------------------------------------------------------------------------

Then I handle the rest of the data when I ask for status (although I should
probably do it every now and then so the tables don't get too big)

Roughly according to the frametime it seems as if things are getting
compiled anyway.

Is this a bug?
Mike Pall
2014-09-05 11:23:07 UTC
Permalink
Post by Elias Hogstvedt
I wrote a profiler for my project using the low level one included in
luajit. In addition to that I wrote something to show trace abort reasons
with jit.attach and then have it show why functions called the most
wouldn't compile.
Using these two together seems to often make the abort reason 0 (error
thrown or hook called during recording)
The Lua profiler callback aborts the recording of ongoing traces.
But trace selection is probabilistic, so it'll eventually record
the trace, anyway.

[The C side of the profiler itself doesn't require any trace
aborts. But the glue code does, since it calls back into the VM
to run the Lua profiler callback.]

--Mike
Elias Hogstvedt
2014-09-05 17:46:35 UTC
Permalink
I'm unsure what I should do now though.

Should I ignore it, should I avoid doing both things at the same time, or
is this something you can fix or prevent? (and in the meantime i'll ignore
it)
Post by Mike Pall
Post by Elias Hogstvedt
I wrote a profiler for my project using the low level one included in
luajit. In addition to that I wrote something to show trace abort reasons
with jit.attach and then have it show why functions called the most
wouldn't compile.
Using these two together seems to often make the abort reason 0 (error
thrown or hook called during recording)
The Lua profiler callback aborts the recording of ongoing traces.
But trace selection is probabilistic, so it'll eventually record
the trace, anyway.
[The C side of the profiler itself doesn't require any trace
aborts. But the glue code does, since it calls back into the VM
to run the Lua profiler callback.]
--Mike
Mike Pall
2014-09-08 22:26:05 UTC
Permalink
Post by Elias Hogstvedt
I'm unsure what I should do now though.
Should I ignore it, should I avoid doing both things at the same time, or
is this something you can fix or prevent? (and in the meantime i'll ignore
it)
Ignore it. It's unlikely that you'll hit the same trace abort
reason for any other cause that would be worth investigating.

--Mike

Loading...