feat: added profiler view

This commit is contained in:
Folke Lemaitre 2022-11-29 12:02:25 +01:00
parent 08b7e42fb0
commit 20ff5fa218
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
9 changed files with 81 additions and 61 deletions

View file

@ -1,16 +1,16 @@
local M = {}
---@alias LazyProfile {name: string, time: number, [number]:LazyProfile}
---@alias LazyProfile {data: string|{[string]:string}, time: number, [number]:LazyProfile}
---@type LazyProfile[]
M._profiles = { { name = "lazy" } }
---@param name string?
---@param data (string|{[string]:string})?
---@param time number?
function M.track(name, time)
if name then
function M.track(data, time)
if data then
local entry = {
name = name,
data = data,
time = time or vim.loop.hrtime(),
}
table.insert(M._profiles[#M._profiles], entry)