mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
feat: added profiler view
This commit is contained in:
parent
08b7e42fb0
commit
20ff5fa218
9 changed files with 81 additions and 61 deletions
|
@ -52,32 +52,6 @@ function M.throttle(ms, fn)
|
|||
end
|
||||
end
|
||||
|
||||
function M.profile()
|
||||
local lines = { "# Profile" }
|
||||
|
||||
---@param entry LazyProfile
|
||||
local function _profile(entry, depth)
|
||||
if entry.time < 0.5 then
|
||||
-- Nothing
|
||||
end
|
||||
|
||||
table.insert(
|
||||
lines,
|
||||
(" "):rep(depth) .. "- " .. entry.name .. ": **" .. math.floor((entry.time or 0) / 1e6 * 100) / 100 .. "ms**"
|
||||
)
|
||||
|
||||
for _, child in ipairs(entry) do
|
||||
_profile(child, depth + 1)
|
||||
end
|
||||
end
|
||||
|
||||
for _, entry in ipairs(M._profiles[1]) do
|
||||
_profile(entry, 1)
|
||||
end
|
||||
|
||||
M.markdown(lines)
|
||||
end
|
||||
|
||||
---@return string?
|
||||
function M.head(file)
|
||||
local f = io.open(file)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue