From 372fd426d84507d58c11e960702117fa7be7181d Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Wed, 21 Feb 2024 18:48:55 -0500 Subject: [PATCH] test code for psil allocations --- test/watch_psil_allocs.lua | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 test/watch_psil_allocs.lua diff --git a/test/watch_psil_allocs.lua b/test/watch_psil_allocs.lua new file mode 100644 index 0000000..a45685e --- /dev/null +++ b/test/watch_psil_allocs.lua @@ -0,0 +1,56 @@ +-- add this to psil: + +--[[ + -- count the number of subscribers in this PSIL instance + ---@return integer count + function public.count() + local c = 0 + for _, val in pairs(ic) do + for _ = 1, #val.subscribers do c = c + 1 end + end + return c + end +]]-- + + +-- add this to coordinator iocontrol front panel heartbeat function: + +--[[ +if io.facility then + local count = io.facility.ps.count() + + count = count + io.facility.env_d_ps.count() + + for x = 1, #io.facility.induction_ps_tbl do + count = count + io.facility.induction_ps_tbl[x].count() + end + + for x = 1, #io.facility.sps_ps_tbl do + count = count + io.facility.sps_ps_tbl[x].count() + end + + for x = 1, #io.facility.tank_ps_tbl do + count = count + io.facility.tank_ps_tbl[x].count() + end + + for i = 1, #io.units do + local entry = io.units[i] ---@type ioctl_unit + + count = count + entry.unit_ps.count() + + for x = 1, #entry.boiler_ps_tbl do + count = count + entry.boiler_ps_tbl[x].count() + end + + for x = 1, #entry.turbine_ps_tbl do + count = count + entry.turbine_ps_tbl[x].count() + end + + for x = 1, #entry.tank_ps_tbl do + count = count + entry.tank_ps_tbl[x].count() + end + end + + log.debug(count) +end +]]--