diff options
author | Andris Zeila <andris.zeila@zabbix.com> | 2020-08-28 10:53:42 +0300 |
---|---|---|
committer | Andris Zeila <andris.zeila@zabbix.com> | 2020-08-28 11:11:02 +0300 |
commit | 3b6e07d1ec2ebb46ebe5294da2a71f362c6a5c1c (patch) | |
tree | 7f1b166d21c6a822b4b5c7e0deb6c15c37ee6636 /include/memalloc.h | |
parent | 7fcb4908ac42281568e4e85f3adefe4a9b6ecd5e (diff) |
.......PS. [ZBXNEXT-6167] added diaginfo runtime command to log internal diagnostic information
* commit 'b9d85eedee7431f9204ac3a00eea559b81486ae7': (45 commits)
.D........ [ZBXNEXT-6167] updated server and proxy man pages
.D........ [ZBXNEXT-6167] added changelog entry
.......PS. [ZBXNEXT-6167] don't allow runtime command on Zabbix agentd
.......PS. [ZBXNEXT-6167] style fix
.......PS. [ZBXNEXT-6167] style fix
.......PS. [ZBXNEXT-6167] simplified main process waiting for dead children
.......PS. [ZBXNEXT-6167] added missing include file, more defines
.......PS. [ZBXNEXT-6167] added diaginfo remote command suppor to proxy
.......PS. [ZBXNEXT-6167] added comments, minor refactoring
........S. [ZBXNEXT-6167] added remote command support for diaginfo printing on server
.......PS. [ZBXNEXT-6167] small style fixes
........S. [ZBXNEXT-6167] fixed value cache diagnostics retrieval with disabled value cache
.......PS. [ZBXNEXT-6167] fixed vector not being destroyed on failure
.......PS. [ZBXNEXT-6167] fixed vector not being destroyed on failure
.......PS. [ZBXNEXT-6167] fixed warning
.......PS. [ZBXNEXT-6167] fixed memory leak
........S. [ZBXNEXT-6167] fixed memory leak
........S. [ZBXNEXT-6167] fixed wrong type used when serializing lld top result
........S. [ZBXNEXT-6167] small style fix
........S. [ZBXNEXT-6167] small style fixes
...
(cherry picked from commit dabac74c51a9d19db24c871f7f8ec247ac540eeb)
Diffstat (limited to 'include/memalloc.h')
-rw-r--r-- | include/memalloc.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/memalloc.h b/include/memalloc.h index c0f11e6238c..8f67d850977 100644 --- a/include/memalloc.h +++ b/include/memalloc.h @@ -23,6 +23,12 @@ #include "common.h" #include "mutexs.h" +#define MEM_MIN_ALLOC 24 /* should be a multiple of 8 and at least (2 * ZBX_PTR_SIZE) */ + +#define MEM_MIN_BUCKET_SIZE MEM_MIN_ALLOC +#define MEM_MAX_BUCKET_SIZE 256 /* starting from this size all free chunks are put into the same bucket */ +#define MEM_BUCKET_COUNT ((MEM_MAX_BUCKET_SIZE - MEM_MIN_BUCKET_SIZE) / 8 + 1) + typedef struct { void **buckets; @@ -44,6 +50,18 @@ typedef struct } zbx_mem_info_t; +typedef struct +{ + zbx_uint64_t free_size; + zbx_uint64_t used_size; + zbx_uint64_t min_chunk_size; + zbx_uint64_t max_chunk_size; + unsigned int chunks_num[MEM_BUCKET_COUNT]; + unsigned int free_chunks; + unsigned int used_chunks; +} +zbx_mem_stats_t; + int zbx_mem_create(zbx_mem_info_t **info, zbx_uint64_t size, const char *descr, const char *param, int allow_oom, char **error); @@ -64,6 +82,7 @@ void __zbx_mem_free(const char *file, int line, zbx_mem_info_t *info, void *ptr) void zbx_mem_clear(zbx_mem_info_t *info); +void zbx_mem_get_stats(const zbx_mem_info_t *info, zbx_mem_stats_t *stats); void zbx_mem_dump_stats(int level, zbx_mem_info_t *info); size_t zbx_mem_required_size(int chunks_num, const char *descr, const char *param); |