mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
feat(debug): profile title
This commit is contained in:
parent
33d31af150
commit
017707955f
1 changed files with 2 additions and 2 deletions
|
@ -51,7 +51,7 @@ end
|
|||
-- * **flush**: set to `true` to use `jit.flush` in every iteration.
|
||||
-- * **count**: defaults to 100
|
||||
---@param fn fun()
|
||||
---@param opts? {count?: number, flush?: boolean}
|
||||
---@param opts? {count?: number, flush?: boolean, title?: string}
|
||||
function M.profile(fn, opts)
|
||||
opts = vim.tbl_extend("force", { count = 100, flush = true }, opts or {})
|
||||
local start = uv.hrtime()
|
||||
|
@ -61,7 +61,7 @@ function M.profile(fn, opts)
|
|||
end
|
||||
fn()
|
||||
end
|
||||
Snacks.notify(((uv.hrtime() - start) / 1e6 / opts.count) .. "ms")
|
||||
Snacks.notify(((uv.hrtime() - start) / 1e6 / opts.count) .. "ms", { title = opts.title or "Profile" })
|
||||
end
|
||||
|
||||
-- Log a message to the file `./debug.log`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue