]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Store mempool fragmentation
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 20 Aug 2017 21:13:25 +0000 (22:13 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 20 Aug 2017 21:13:25 +0000 (22:13 +0100)
src/controller.c
src/libutil/mem_pool.c
src/libutil/mem_pool.h

index e3f4c5d3afbc85065b0a48ca441fde791392e39d..c3af1e4bac6da023d8738f603ecbabe64582d468 100644 (file)
@@ -2646,6 +2646,8 @@ rspamd_controller_handle_stat_common (
        ucl_object_insert_key (top,
                ucl_object_fromint (
                        mem_st.oversized_chunks), "chunks_oversized", 0, false);
+       ucl_object_insert_key (top,
+                       ucl_object_fromint (mem_st.fragmented_size), "fragmented", 0, false);
 
        if (do_reset) {
                session->ctx->srv->stat->messages_scanned = 0;
index 187d3ca66021e7d39d77748412d22c42187cc4a0..b5cfae3112134a839604e7652f25b9bcdd5c0c4c 100644 (file)
@@ -317,6 +317,8 @@ memory_pool_alloc_common (rspamd_mempool_t * pool, gsize size,
                        }
                        else {
                                mem_pool_stat->oversized_chunks++;
+                               g_atomic_int_add (&mem_pool_stat->fragmented_size,
+                                               free);
                                new = rspamd_mempool_chain_new (
                                                size + pool->elt_len + MEM_ALIGNMENT, pool_type);
                        }
index 2771be0dbf9e98bbe1954bd135bf5fec55684128..b3ea8709989f6bcb21a7f572b0e5e5d77a7974c4 100644 (file)
@@ -110,6 +110,7 @@ typedef struct memory_pool_stat_s {
        guint shared_chunks_allocated;      /**< shared chunks allocated                                                        */
        guint chunks_freed;                 /**< chunks freed                                                                           */
        guint oversized_chunks;             /**< oversized chunks                                                                       */
+       guint fragmented_size;                /**< fragmentation size                                                           */
 } rspamd_mempool_stat_t;