MINOR: pools: report it when malloc_trim() is enabled
Since we can detect it at runtime now, it could help to have it mentioned in haproxy -vv.
This commit is contained in:
parent
157e393039
commit
845b560f6a
21
src/pool.c
21
src/pool.c
|
@ -68,6 +68,11 @@ static void detect_allocator(void)
|
|||
|
||||
using_libc_allocator = !!memcmp(&mi1, &mi2, sizeof(mi1));
|
||||
}
|
||||
|
||||
static int is_trim_enabled(void)
|
||||
{
|
||||
return using_libc_allocator;
|
||||
}
|
||||
#else
|
||||
|
||||
static void trim_all_pools(void)
|
||||
|
@ -77,6 +82,11 @@ static void trim_all_pools(void)
|
|||
static void detect_allocator(void)
|
||||
{
|
||||
}
|
||||
|
||||
static int is_trim_enabled(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Try to find an existing shared pool with the same characteristics and
|
||||
|
@ -540,6 +550,17 @@ static void init_pools()
|
|||
|
||||
INITCALL0(STG_PREPARE, init_pools);
|
||||
|
||||
/* Report in build options if trim is supported */
|
||||
static void pools_register_build_options(void)
|
||||
{
|
||||
if (is_trim_enabled()) {
|
||||
char *ptr = NULL;
|
||||
memprintf(&ptr, "Support for malloc_trim() is enabled.");
|
||||
hap_register_build_opts(ptr, 1);
|
||||
}
|
||||
}
|
||||
INITCALL0(STG_REGISTER, pools_register_build_options);
|
||||
|
||||
/* register cli keywords */
|
||||
static struct cli_kw_list cli_kws = {{ },{
|
||||
{ { "show", "pools", NULL }, "show pools : report information about the memory pools usage", NULL, cli_io_handler_dump_pools },
|
||||
|
|
Loading…
Reference in New Issue