Comparison

mod_measure_memory/mod_measure_memory.lua @ 4040:e17c937a71b3

mod_measure_memory: Report that stats are in units of bytes
author Kim Alvefur <zash@zash.se>
date Wed, 10 Jun 2020 12:12:47 +0200
parent 3365:a5a5f85d7ca1
comparison
equal deleted inserted replaced
4039:2af0301af734 4040:e17c937a71b3
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("amount", "memory."..k); t[k] = m; return m; 8 local m = measure("amount", "memory."..k, { units = "bytes" }); 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);