3 local measure
= require
"core.statsmanager".measure
;
6 setmetatable(measures
, {
7 __index
= function (t
, k
)
8 local m
= measure("amount", "memory."..k
); t
[k
] = m
; return m
;
12 module
:hook("stats-update", function ()
13 measures
.lua(collectgarbage("count")*1024);
16 if require
"lfs".attributes("/proc/self/statm", "mode") == "file" then
17 local pagesize
= module
:get_option_number("memory_pagesize", 4096); -- getconf PAGESIZE
19 module
:hook("stats-update", function ()
20 local statm
, err
= io
.open("/proc/self/statm");
22 module
:log("error", tostring(err
));
25 -- virtual memory (caches, opened librarys, everything)
26 measures
.total(statm
:read("*n") * pagesize
);
27 -- resident set size (actually used memory)
28 measures
.rss(statm
:read("*n") * pagesize
);