Added debug tools
This commit is contained in:
parent
e44aedffc2
commit
328f7aa71b
|
@ -1,5 +1,6 @@
|
|||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local debug = require("libs.debug")
|
||||
|
||||
local globalkeys = gears.table.join(
|
||||
awful.key({ global.modkey, }, "Left", awful.tag.viewprev,
|
||||
|
@ -76,7 +77,21 @@ local globalkeys = gears.table.join(
|
|||
)
|
||||
end
|
||||
end,
|
||||
{description = "restore minimized", group = "client"})
|
||||
{description = "restore minimized", group = "client"}),
|
||||
awful.key({global.modkey,"Control" }, "s", function()
|
||||
debug.print_awesome_memory_stats("Precollect")
|
||||
collectgarbage("collect")
|
||||
collectgarbage("collect")
|
||||
gears.timer {
|
||||
callback = function()
|
||||
debug.print_awesome_memory_stats("Postcollect")
|
||||
return false
|
||||
end,
|
||||
timeout = 5,
|
||||
autostart = true,
|
||||
single_shot = true
|
||||
}
|
||||
end, {description = "print awesome wm memory statistics", group="awesome"})
|
||||
)
|
||||
|
||||
-- Bind all key numbers to tags.
|
||||
|
@ -127,6 +142,7 @@ for i = 1, 9 do
|
|||
end,
|
||||
{description = "toggle focused client on tag #" .. i, group = "tag"})
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
return globalkeys
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
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
|
Loading…
Reference in New Issue