-
-
Notifications
You must be signed in to change notification settings - Fork 314
Description
I was using the plenary.profile
package and capturing profiles using it. It looks like it's super useful for my case. I was using the flamegraph output to get some nice profiler to visualize in the Firefox Profiler. But the profiles that I gathered weren't so useful.
For example here's one: https://share.firefox.dev/4ejyKHG
It wasn't very useful to me because it wasn't possible to see which file or function comes from which module exactly.
But after looking at the documentation of jit.p
, I realized that it's possible to send different options that might make it more useful for me.
For example, here I see that I can also pass p
and F
that could make the output more useful for me:
plenary.nvim/lua/plenary/profile/p.lua
Lines 22 to 38 in 857c5ac
-- The following dump features are available: | |
-- | |
-- f Stack dump: function name, otherwise module:line. Default mode. | |
-- F Stack dump: ditto, but always prepend module. | |
-- l Stack dump: module:line. | |
-- <number> stack dump depth (callee < caller). Default: 1. | |
-- -<number> Inverse stack dump depth (caller > callee). | |
-- s Split stack dump after first stack level. Implies abs(depth) >= 2. | |
-- p Show full path for module names. | |
-- v Show VM states. Can be combined with stack dumps, e.g. vf or fv. | |
-- z Show zones. Can be combined with stack dumps, e.g. zf or fz. | |
-- r Show raw sample counts. Default: show percentages. | |
-- a Annotate excerpts from source code files. | |
-- A Annotate complete source code files. | |
-- G Produce raw output suitable for graphical tools (e.g. flame graphs). | |
-- m<number> Minimum sample percentage to be shown. Default: 3. | |
-- i<number> Sampling interval in milliseconds. Default: 10. |
But currently there is no way to pass additional popts
or override the default ones:
plenary.nvim/lua/plenary/profile.lua
Lines 12 to 18 in 857c5ac
function profile.start(out, opts) | |
out = out or "profile.log" | |
opts = opts or {} | |
local popts = "10,i1,s,m0" | |
if opts.flame then popts = popts .. ",G" end | |
p.start(popts, out) | |
end |
It's not the end of the worlds since I can still manually add these arguments or call jit.p
directly. But it would be nicer if plenary had an option to do it too.
Here's the output with these:
https://share.firefox.dev/460Xsdw
Now it's a lot more actionable for me, since I can see which file comes from which package exactly.
So my feature request would be to make this profiler.start
API accept pargs
as an argument so users can override them.