diff --git a/doc/internals/api/pools.txt b/doc/internals/api/pools.txt index 480cf24e5..d84fb9d01 100644 --- a/doc/internals/api/pools.txt +++ b/doc/internals/api/pools.txt @@ -439,14 +439,14 @@ int pool_total_failures(void) and is only meant to be used as an indicator rather than a precise measure. -ulong pool_total_allocated(void) +ullong pool_total_allocated(void) Report the total number of bytes allocated in all pools, for reporting in the "PoolAlloc_MB" field of the "show info" output. The total is calculated on the fly by summing the number of allocated bytes in all pools and is only meant to be used as an indicator rather than a precise measure. -ulong pool_total_used(void) +ullong pool_total_used(void) Report the total number of bytes used in all pools, for reporting in the "PoolUsed_MB" field of the "show info" output. The total is calculated on the fly by summing the number of used bytes in all pools diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h index 127514661..16146604b 100644 --- a/include/haproxy/pool.h +++ b/include/haproxy/pool.h @@ -108,8 +108,8 @@ void pool_free_nocache(struct pool_head *pool, void *ptr); void dump_pools(void); int pool_parse_debugging(const char *str, char **err); int pool_total_failures(void); -unsigned long pool_total_allocated(void); -unsigned long pool_total_used(void); +unsigned long long pool_total_allocated(void); +unsigned long long pool_total_used(void); void pool_flush(struct pool_head *pool); void pool_gc(struct pool_head *pool_ctx); struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags); diff --git a/src/pool.c b/src/pool.c index 610e20cc3..4ea8d8127 100644 --- a/src/pool.c +++ b/src/pool.c @@ -980,24 +980,24 @@ int pool_total_failures() } /* This function returns the total amount of memory allocated in pools (in bytes) */ -unsigned long pool_total_allocated() +unsigned long long pool_total_allocated() { struct pool_head *entry; - unsigned long allocated = 0; + unsigned long long allocated = 0; list_for_each_entry(entry, &pools, list) - allocated += entry->allocated * entry->size; + allocated += entry->allocated * (ullong)entry->size; return allocated; } /* This function returns the total amount of memory used in pools (in bytes) */ -unsigned long pool_total_used() +unsigned long long pool_total_used() { struct pool_head *entry; - unsigned long used = 0; + unsigned long long used = 0; list_for_each_entry(entry, &pools, list) - used += entry->used * entry->size; + used += entry->used * (ullong)entry->size; return used; } diff --git a/src/stats.c b/src/stats.c index 7b664c129..84a4f9b6e 100644 --- a/src/stats.c +++ b/src/stats.c @@ -4541,9 +4541,9 @@ int stats_fill_info(struct field *info, int len, uint flags) info[INF_MEMMAX_MB] = mkf_u32(FO_CONFIG|FN_LIMIT, global.rlimit_memmax); info[INF_MEMMAX_BYTES] = mkf_u32(FO_CONFIG|FN_LIMIT, global.rlimit_memmax * 1048576L); info[INF_POOL_ALLOC_MB] = mkf_u32(0, (unsigned)(pool_total_allocated() / 1048576L)); - info[INF_POOL_ALLOC_BYTES] = mkf_u32(0, pool_total_allocated()); + info[INF_POOL_ALLOC_BYTES] = mkf_u64(0, pool_total_allocated()); info[INF_POOL_USED_MB] = mkf_u32(0, (unsigned)(pool_total_used() / 1048576L)); - info[INF_POOL_USED_BYTES] = mkf_u32(0, pool_total_used()); + info[INF_POOL_USED_BYTES] = mkf_u64(0, pool_total_used()); info[INF_POOL_FAILED] = mkf_u32(FN_COUNTER, pool_total_failures()); info[INF_ULIMIT_N] = mkf_u32(FO_CONFIG|FN_LIMIT, global.rlimit_nofile); info[INF_MAXSOCK] = mkf_u32(FO_CONFIG|FN_LIMIT, global.maxsock);