From 0f2786bcc91347188627534471ee75c3f6f16b2d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 4 Jul 2024 15:17:02 +0200 Subject: [PATCH] feat(profiling): merge VeryLazy stats and show startuptime in profile view --- lua/lazy/core/handler/event.lua | 8 ++++++-- lua/lazy/core/util.lua | 2 ++ lua/lazy/stats.lua | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lua/lazy/core/handler/event.lua b/lua/lazy/core/handler/event.lua index aff4572..a34e0c5 100644 --- a/lua/lazy/core/handler/event.lua +++ b/lua/lazy/core/handler/event.lua @@ -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) @@ -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 diff --git a/lua/lazy/core/util.lua b/lua/lazy/core/util.lua index 185527b..6d7c3b8 100644 --- a/lua/lazy/core/util.lua +++ b/lua/lazy/core/util.lua @@ -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 diff --git a/lua/lazy/stats.lua b/lua/lazy/stats.lua index 36865db..015a2be 100644 --- a/lua/lazy/stats.lua +++ b/lua/lazy/stats.lua @@ -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