new (?) performance profiling tool #6297

Open
opened 2024-02-15 21:15:44 +00:00 by flux · 11 comments
Member

i swear someone sent me a flame graph before, but i've apparently never used this tool myself:

https://content.minetest.net/packages/jwmhjwmh/jitprofiler/

i'm currently using it locally to try to analyze the performance of spawnit and other things.

image

image

i swear someone sent me a flame graph before, but i've apparently never used this tool myself: https://content.minetest.net/packages/jwmhjwmh/jitprofiler/ i'm currently using it locally to try to analyze the performance of spawnit and other things. ![image](/attachments/a61b4cc3-f8ca-4ee1-92f9-d8be435f1811) ![image](/attachments/97b8bc9f-9642-4ede-8e10-c44a3f5f9882)
flux added the
1. kind/enhancement
label 2024-02-15 21:15:44 +00:00
Member

Oh, I liked to use it years before for analyzing perf record dumps, but somehow it got broken when I tried it again recently :/
I think format changed? I should try it again maybe.

But if it works for luajit, then it's good too - those visuals are nice :)

IIRC those are svg files and they have labels with full function names, etc. Maybe even interactive?

Oh, I liked to use it years before for analyzing `perf record` dumps, but somehow it got broken when I tried it again recently :/ I think format changed? I should try it again maybe. But if it works for luajit, then it's good too - those visuals are nice :) IIRC those are svg files and they have labels with full function names, etc. Maybe even interactive?

I tried it as well on testserver, but when I used it on main, it somehow killed the server. There is a warning on the repo that mesecon might have unforeseen consequences, maybe that's what happened?

I tried it as well on testserver, but when I used it on main, it somehow killed the server. There is a warning on the repo that mesecon might have unforeseen consequences, maybe that's what happened?
Author
Member

There is a warning on the repo that mesecon might have unforeseen consequences, maybe that's what happened?

hm. it might be that the jit profiler crashes when there's a pcall? that unfortunately makes this totally useless, as i wanted to run it on main, but we can't disable luacontrollers or there'd be a riot.

> There is a warning on the repo that mesecon might have unforeseen consequences, maybe that's what happened? hm. it might be that the jit profiler crashes when there's a `pcall`? that unfortunately makes this totally useless, as i wanted to run it on main, but we can't disable luacontrollers or there'd be a riot.
Author
Member

hm. it might be that the jit profiler crashes when there's a pcall?

that doesn't seem to be it, the following runs just fine locally:

local profile = require("jit.profile")

local outfile = io.open("profile.out", "w")
local function record(thread, samples, vmstate)
    outfile:write(profile.dumpstack(thread, "pF;", -100), vmstate, " ", samples, "\n")
end
profile.start("vfi1", record)

local function do_stuff()
    local i = 0
    for j = 1, 10000000 do
        i = i + j
    end
    return i
end

for _ = 1, 20 do
    local ok, ret = pcall(do_stuff)
    if ok then
        print(ret)
    else
        print(error)
    end
end
profile.stop()
outfile:close()

print("done")
> hm. it might be that the jit profiler crashes when there's a `pcall`? that doesn't seem to be it, the following runs just fine locally: ```lua local profile = require("jit.profile") local outfile = io.open("profile.out", "w") local function record(thread, samples, vmstate) outfile:write(profile.dumpstack(thread, "pF;", -100), vmstate, " ", samples, "\n") end profile.start("vfi1", record) local function do_stuff() local i = 0 for j = 1, 10000000 do i = i + j end return i end for _ = 1, 20 do local ok, ret = pcall(do_stuff) if ok then print(ret) else print(error) end end profile.stop() outfile:close() print("done") ```
Member

do we have a stack trace? error? any clue about how it crashed?

do we have a stack trace? error? any clue about how it crashed?

I don't remember exactly, but I believe the server just stopped responding and I had to restart it. There was no stacktrace nor any logging, even the output file was malformed.

We could try to recreate the experiment on the testserver, as far as I remember it happened there as well, but the crash took longer to surface

I don't remember exactly, but I believe the server just stopped responding and I had to restart it. There was no stacktrace nor any logging, even the output file was malformed. We could try to recreate the experiment on the testserver, as far as I remember it happened there as well, but the crash took longer to surface
Author
Member

I don't remember exactly, but I believe the server just stopped responding and I had to restart it.

when i was running this tool locally, my server once stopped responding when i executed the "stop profiling" command. it certainly can cause hangs, i've got no ideas on why though.

> I don't remember exactly, but I believe the server just stopped responding and I had to restart it. when i was running this tool locally, my server once stopped responding when i executed the "stop profiling" command. it certainly can cause hangs, i've got no ideas on why though.
Author
Member

this could probably be closed as "maybe" until the hang issue is better understood

this could probably be closed as "maybe" until the hang issue is better understood

Let's not close but investigate in this issue why the hangs happen. It's a useful tool and the whole of MT could profit if we find the cause.

Let's not close but investigate in this issue why the hangs happen. It's a useful tool and the whole of MT could profit if we find the cause.
Author
Member

simple luac scripts are apparently not enough to trigger the bug (if it's even the luacs)

if event.type == "program" then
 interrupt(1)
elseif event.type == "interrupt" then
 port.b = not port.b
 interrupt(1)
end
simple luac scripts are apparently not enough to trigger the bug (if it's even the luacs) ```lua if event.type == "program" then interrupt(1) elseif event.type == "interrupt" then port.b = not port.b interrupt(1) end ```
Author
Member

also, while i don't think the mod is the issue (probably it's either luajit itself or some way that minetest is using it), the developer of the mod is dead.

also, while i don't think the mod is the issue (probably it's either luajit itself or some way that minetest is using it), the developer of the mod is dead.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: your-land/bugtracker#6297
No description provided.