mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
feat(profile): added accurate startuptime to ui/stats/docs
This commit is contained in:
parent
d1739cb7e1
commit
a2fdf369f2
6 changed files with 103 additions and 11 deletions
|
@ -491,6 +491,24 @@ function M:details(plugin)
|
|||
end
|
||||
|
||||
function M:profile()
|
||||
local stats = require("lazy.stats").stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
self:append("Startuptime: ", "LazyH2"):append(ms .. "ms", "Number"):nl():nl()
|
||||
if stats.startuptime_cputime then
|
||||
self:append("Based on the actual CPU time of the Neovim process till "):append("UIEnter", "LazySpecial")
|
||||
self:append("."):nl()
|
||||
self:append("This is more accurate than ")
|
||||
self:append("`nvim --startuptime`", "@text.literal.markdown_inline")
|
||||
self:append(".")
|
||||
else
|
||||
self:append("An accurate startuptime based on the actual CPU time of the Neovim process is not available."):nl()
|
||||
self
|
||||
:append("Startuptime is instead based on a delta with a timestamp when lazy started till ")
|
||||
:append("UIEnter", "LazySpecial")
|
||||
self:append(".")
|
||||
end
|
||||
self:nl():nl()
|
||||
|
||||
self:append("Profile", "LazyH2"):nl():nl()
|
||||
self
|
||||
:append("You can press ")
|
||||
|
@ -505,6 +523,8 @@ function M:profile()
|
|||
|
||||
self:nl()
|
||||
|
||||
self:nl():nl()
|
||||
|
||||
---@param a LazyProfile
|
||||
---@param b LazyProfile
|
||||
local function sort(a, b)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue