/
dlc
/
similarity-compiler
Обзор
Документация
Войти
/
dlc
/
similarity-compiler
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
dev
tools/lua/jit/zone.lua
44 строки
1002 B
yoona
feat: initial release
06 май 2024, 10:18
06 май 2024, 10:18
a796040
Код
Авторство
О чём код?
---------------------------------------------------------------------------- -- LuaJIT profiler zones. -- -- Copyright (C) 2005-2017 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 })