Software /
code /
prosody-modules
Comparison
mod_measure_memory/mod_measure_memory.lua @ 3365:a5a5f85d7ca1
mod_measure_memory: Use the 'amount' measure type
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 29 Oct 2018 01:10:10 +0100 |
parent | 2708:07d6077d2db7 |
child | 4040:e17c937a71b3 |
comparison
equal
deleted
inserted
replaced
3364:264eab9d501c | 3365:a5a5f85d7ca1 |
---|---|
3 local measure = require"core.statsmanager".measure; | 3 local measure = require"core.statsmanager".measure; |
4 | 4 |
5 local measures = {}; | 5 local measures = {}; |
6 setmetatable(measures, { | 6 setmetatable(measures, { |
7 __index = function (t, k) | 7 __index = function (t, k) |
8 local m = measure("sizes", "memory."..k); t[k] = m; return m; | 8 local m = measure("amount", "memory."..k); t[k] = m; return m; |
9 end | 9 end |
10 }); | 10 }); |
11 | 11 |
12 module:hook("stats-update", function () | 12 module:hook("stats-update", function () |
13 measures.lua(collectgarbage("count")*1024); | 13 measures.lua(collectgarbage("count")*1024); |