mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
First code cleanup for better memory management
This commit is contained in:
parent
b5a4c2621b
commit
2f76c9bf4b
21 changed files with 968 additions and 852 deletions
23
scripts/lua/modules/profiling.lua
Normal file
23
scripts/lua/modules/profiling.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
--
|
||||
-- (C) 2016-24 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
-- #################################
|
||||
|
||||
local profiling = {}
|
||||
|
||||
-- #################################
|
||||
|
||||
function profiling.get_current_memory(file)
|
||||
require "lua_trace"
|
||||
|
||||
local lua_memory_usage = collectgarbage("count")
|
||||
traceError(TRACE_NORMAL, TRACE_CONSOLE, "Currently executing file: " .. file .. "; Current LUA memory usage: " .. lua_memory_usage .. " KB")
|
||||
end
|
||||
|
||||
-- #################################
|
||||
|
||||
return profiling
|
||||
Loading…
Add table
Add a link
Reference in a new issue