GSServer-CBT/soggy_resources/lua/Base/BenchMark.lua

33 lines
635 B
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

----------------------
-- 这是Lua端BenchMark包含了一些profiler和memory的操作
-- @module BenchMark
local BenchMark = {
memory = require('Base/memory'),
profiler = require('Base/profiler')
}
--- Profiler方法
-- @section profiler
function BenchMark:StartProfiler()
self.profiler.start()
end
function BenchMark:StopProfiler()
self.profiler.stop()
end
function BenchMark:Report()
print(self.profiler.report())
end
--- Memory方法
-- @section memory
function BenchMark:PrintTotalMemory()
return self.memory.total()
end
function BenchMark:PrintMemorySnapshot()
print(self.memory.snapshot())
end
return BenchMark