Skip to content

Commit

Permalink
feat(profiling): merge VeryLazy stats and show startuptime in profile…
Browse files Browse the repository at this point in the history
… view
  • Loading branch information
folke committed Jul 4, 2024
1 parent cea5920 commit 0f2786b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/lazy/core/handler/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ function M:_add(event)
end
-- HACK: work-around for https://github.com/neovim/neovim/issues/25526
done = true
Util.track({ [self.type] = event.id })
if event.id ~= "VeryLazy" then
Util.track({ [self.type] = event.id })
end

local state = M.get_state(ev.event, ev.buf, ev.data)

Expand All @@ -86,7 +88,9 @@ function M:_add(event)
for _, s in ipairs(state) do
M.trigger(s)
end
Util.track()
if event.id ~= "VeryLazy" then
Util.track()
end
end,
})
end
Expand Down
2 changes: 2 additions & 0 deletions lua/lazy/core/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ function M.very_lazy()
return
end
vim.g.did_very_lazy = true
M.track({ event = "VeryLazy" })
vim.api.nvim_exec_autocmds("User", { pattern = "VeryLazy", modeline = false })
M.track()
end)
end

Expand Down
1 change: 1 addition & 0 deletions lua/lazy/stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ M.C = nil

function M.on_ui_enter()
M._stats.startuptime = M.track("UIEnter")
require("lazy.core.util").track({ start = "startuptime" }, M._stats.startuptime * 1e6)
vim.api.nvim_exec_autocmds("User", { pattern = "LazyVimStarted", modeline = false })
end

Expand Down

0 comments on commit 0f2786b

Please sign in to comment.