reno/libs/debug.lua

18 lines
897 B
Lua
Raw Normal View History

2022-07-12 21:26:11 +00:00
local naughty = require("naughty")
local debug = {}
-- Thanks, u/skhil
-- (https://www.reddit.com/r/awesomewm/comments/te49nb/why_does_awesomes_ram_consumption_get_higher_and/)
function debug.print_awesome_memory_stats(message)
print(os.date(), "\nLua memory usage:", collectgarbage("count"))
out_string = tostring(os.date()) .. "\nLua memory usage:"..tostring(collectgarbage("count")).."\n"
out_string = out_string .. "Objects alive:"
print("Objects alive:")
for name, obj in pairs{ button = button, client = client, drawable = drawable, drawin = drawin, key = key, screen = screen, tag = tag } do
out_string =out_string .. "\n" .. tostring(name) .. " = " ..tostring(obj.instances())
print(name, obj.instances())
end
naughty.notify({title = "Awesome WM memory statistics " .. message, text = out_string, timeout=20,hover_timeout=20})
end
return debug