GUI: add active timeouts and busy memory blocks counters

- Add timeout_heap_get_size() to get active timer count
- Add global counters in memory_pool: g_total_free and g_total_allocated
- Simplify busy memory calculation to single formula:
  busy = memory_pool_get_total_allocated() - memory_pool_get_total_free_blocks()
- Add new IDC_EDIT_ACTIVE_TIMEOUTS and IDC_EDIT_BUSY_MEMORY to GUI
This commit is contained in:
Evgeny committed 2026-04-21 17:22:58 +03:00
1 parent e596564abd
commit cee9a04348
8 files changed
+70 -4

No files matched your search

+11
View File
@@ -14,6 +14,8 @@
#include "pkt_normalizer.h"
#include "../tools/etcpmon/etcpmon_protocol.h"
#include "../lib/u_async.h"
#include "../lib/timeout_heap.h"
#include "../lib/memory_pool.h"
#include "../lib/debug_config.h"
#include "../lib/mem.h"
#include "../lib/ll_queue.h"
@@ -971,6 +973,15 @@ static void send_metrics(struct control_server* server, struct control_client* c
for (int i = 0; i < 8; i++) {
rsp->etcp.debug[i] = conn->debug[i];
}
/* System resources */
if (instance->ua && instance->ua->timeout_heap) {
rsp->etcp.active_timeouts = (uint32_t)timeout_heap_get_size(instance->ua->timeout_heap);
} else {
rsp->etcp.active_timeouts = 0;
}
rsp->etcp.busy_memory_blocks = (uint32_t)(memory_pool_get_total_allocated() - memory_pool_get_total_free_blocks());
/* Fill TUN metrics */
if (instance->tun) {