mirror of
https://github.com/love2d/megasource.git
synced 2026-08-12 00:20:55 +02:00
9618942ec0
NDK r29 is used to compile the binaries. It's 16KB-aligned for x86-64 and arm64-v8a.
46 lines
1002 B
Lua
46 lines
1002 B
Lua
----------------------------------------------------------------------------
|
|
-- LuaJIT profiler zones.
|
|
--
|
|
-- Copyright (C) 2005-2025 Mike Pall. All rights reserved.
|
|
-- Released under the MIT license. See Copyright Notice in luajit.h
|
|
----------------------------------------------------------------------------
|
|
--
|
|
-- This module implements a simple hierarchical zone model.
|
|
--
|
|
-- Example usage:
|
|
--
|
|
-- local zone = require("jit.zone")
|
|
-- zone("AI")
|
|
-- ...
|
|
-- zone("A*")
|
|
-- ...
|
|
-- print(zone:get()) --> "A*"
|
|
-- ...
|
|
-- zone()
|
|
-- ...
|
|
-- print(zone:get()) --> "AI"
|
|
-- ...
|
|
-- zone()
|
|
--
|
|
----------------------------------------------------------------------------
|
|
|
|
local remove = table.remove
|
|
|
|
return setmetatable({
|
|
flush = function(t)
|
|
for i=#t,1,-1 do t[i] = nil end
|
|
end,
|
|
get = function(t)
|
|
return t[#t]
|
|
end
|
|
}, {
|
|
__call = function(t, zone)
|
|
if zone then
|
|
t[#t+1] = zone
|
|
else
|
|
return (assert(remove(t), "empty zone stack"))
|
|
end
|
|
end
|
|
})
|
|
|