Skip to content

Commit

Permalink
Merge branch 'main' into ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
kodewdle committed Nov 25, 2024
2 parents 71a2966 + 4146830 commit acd4ecb
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions ElvUI_Libraries/Core/oUF/simpy/profiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ _info.data = _data
_info.fps = _fps

local depth = 0
local debug = function(num, start)
local Debug = function(num, start)
depth = depth + num

if num == -1 and (depth % 2 == 1) then
Expand All @@ -35,9 +35,9 @@ local debug = function(num, start)
end

local Profile = function(func, ...)
local start = debug(1)
local start = Debug(1)
local args = { func(...) }
local finish = debug(-1, start) - start
local finish = Debug(-1, start) - start

return start, finish, args
end
Expand Down Expand Up @@ -151,6 +151,20 @@ local Generator = function(object, key, value)
end
end

local meta = { __newindex = Generator }
_info.func = function(tbl, ...)
-- print('Profiler', tbl)

local t = getmetatable(tbl)
if t then
t.__newindex = Generator

return tbl, ...
else
return setmetatable(tbl, meta), ...
end
end

_info.add = function(func)
if not _funcs[func] then
_funcs[func] = {}
Expand Down Expand Up @@ -180,20 +194,6 @@ _info.state = function(value)
_info._enabled = value
end

local meta = { __newindex = Generator }
_info.func = function(tbl, ...)
-- print('Profiler', tbl)

local t = getmetatable(tbl)
if t then
t.__newindex = Generator

return tbl, ...
else
return setmetatable(tbl, meta), ...
end
end

-- lets collect some FPS info
local CollectRate = function(rate)
local all = _fps._all
Expand Down

0 comments on commit acd4ecb

Please sign in to comment.