Mercurial > prosody-modules
comparison mod_measure_memory/mod_measure_memory.lua @ 2436:a01a3fb96302
mod_measure_memory: Module is global, no need for a global hook
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 06 Jan 2017 17:07:01 +0100 |
| parents | 4d38b8c03dfe |
| children | 07d6077d2db7 |
comparison
equal
deleted
inserted
replaced
| 2435:05248d5a7166 | 2436:a01a3fb96302 |
|---|---|
| 13 module:hook("stats-update", function () | 13 module:hook("stats-update", function () |
| 14 measures.lua(collectgarbage("count")*1024); | 14 measures.lua(collectgarbage("count")*1024); |
| 15 end); | 15 end); |
| 16 | 16 |
| 17 if have_pposix and pposix.meminfo then | 17 if have_pposix and pposix.meminfo then |
| 18 module:hook_global("stats-update", function () | 18 module:hook("stats-update", function () |
| 19 local m = measures; | 19 local m = measures; |
| 20 for k, v in pairs(pposix.meminfo()) do | 20 for k, v in pairs(pposix.meminfo()) do |
| 21 m[k](v); | 21 m[k](v); |
| 22 end | 22 end |
| 23 end); | 23 end); |
