Mercurial > prosody-modules
annotate mod_measure_malloc/mod_measure_malloc.lua @ 4423:ca821df93cb9
mod_groups_internal: correctly destroy MUC associated with group
Turns out, delete does not do what I think it does. destroy does
what I think it does.
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Tue, 02 Feb 2021 22:28:09 +0100 |
parents | a83eed629d4b |
children | 5b4f43b90766 |
rev | line source |
---|---|
1623
2c39af0fb93b
mod_measure_memory: Module for polling memory useage from Lua, meminfo() and /proc depending on availability
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 module:set_global(); |
2c39af0fb93b
mod_measure_memory: Module for polling memory useage from Lua, meminfo() and /proc depending on availability
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 |
2c39af0fb93b
mod_measure_memory: Module for polling memory useage from Lua, meminfo() and /proc depending on availability
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 local measure = require"core.statsmanager".measure; |
2708
07d6077d2db7
mod_measure_memory: Split out mallinfo measuring into a separate module, mod_measure_malloc
Kim Alvefur <zash@zash.se>
parents:
2436
diff
changeset
|
4 local pposix = require"util.pposix"; |
1623
2c39af0fb93b
mod_measure_memory: Module for polling memory useage from Lua, meminfo() and /proc depending on availability
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 |
2c39af0fb93b
mod_measure_memory: Module for polling memory useage from Lua, meminfo() and /proc depending on availability
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 local measures = {}; |
2c39af0fb93b
mod_measure_memory: Module for polling memory useage from Lua, meminfo() and /proc depending on availability
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 setmetatable(measures, { |
1655
4d38b8c03dfe
mod_measure_memory: Silence warnings [luacheck]
Kim Alvefur <zash@zash.se>
parents:
1623
diff
changeset
|
8 __index = function (t, k) |
3367
a83eed629d4b
mod_measure_malloc: Use the 'amount' measure type
Kim Alvefur <zash@zash.se>
parents:
2708
diff
changeset
|
9 local m = measure("amount", "memory."..k); t[k] = m; return m; |
1623
2c39af0fb93b
mod_measure_memory: Module for polling memory useage from Lua, meminfo() and /proc depending on availability
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 end |
2c39af0fb93b
mod_measure_memory: Module for polling memory useage from Lua, meminfo() and /proc depending on availability
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 }); |
2c39af0fb93b
mod_measure_memory: Module for polling memory useage from Lua, meminfo() and /proc depending on availability
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 module:hook("stats-update", function () |
2708
07d6077d2db7
mod_measure_memory: Split out mallinfo measuring into a separate module, mod_measure_malloc
Kim Alvefur <zash@zash.se>
parents:
2436
diff
changeset
|
13 local m = measures; |
07d6077d2db7
mod_measure_memory: Split out mallinfo measuring into a separate module, mod_measure_malloc
Kim Alvefur <zash@zash.se>
parents:
2436
diff
changeset
|
14 for k, v in pairs(pposix.meminfo()) do |
07d6077d2db7
mod_measure_memory: Split out mallinfo measuring into a separate module, mod_measure_malloc
Kim Alvefur <zash@zash.se>
parents:
2436
diff
changeset
|
15 m[k](v); |
07d6077d2db7
mod_measure_memory: Split out mallinfo measuring into a separate module, mod_measure_malloc
Kim Alvefur <zash@zash.se>
parents:
2436
diff
changeset
|
16 end |
1623
2c39af0fb93b
mod_measure_memory: Module for polling memory useage from Lua, meminfo() and /proc depending on availability
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 end); |