mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
DEBUG: pools: store the pool registration file name and line number
When pools are declared using DECLARE_POOL(), REGISTER_POOL etc, we know where they are and it's trivial to retrieve the file name and line number, so let's store them in the pool_registration, and display them when known in "show pools detailed".
This commit is contained in:
parent
ff62aacb20
commit
efa856a8b0
@ -71,6 +71,8 @@ struct pool_cache_head {
|
||||
struct pool_registration {
|
||||
struct list list; /* link element */
|
||||
const char *name; /* name of the pool */
|
||||
const char *file; /* where the pool is declared */
|
||||
unsigned int line; /* line in the file where the pool is declared, 0 if none */
|
||||
unsigned int size; /* expected object size */
|
||||
unsigned int flags; /* MEM_F_* */
|
||||
unsigned int align; /* expected alignment; 0=unspecified */
|
||||
|
@ -36,6 +36,8 @@
|
||||
#define __REGISTER_POOL(_line, _ptr, _name, _size) \
|
||||
static struct pool_registration __pool_reg_##_line = { \
|
||||
.name = _name, \
|
||||
.file = __FILE__, \
|
||||
.line = __LINE__, \
|
||||
.size = _size, \
|
||||
.flags = MEM_F_STATREG, \
|
||||
.align = 0, \
|
||||
|
@ -1321,8 +1321,12 @@ void dump_pools_to_trash(int how, int max, const char *pfx)
|
||||
|
||||
if (detailed) {
|
||||
struct pool_registration *reg;
|
||||
list_for_each_entry(reg, &pool_info[i].entry->regs, list)
|
||||
chunk_appendf(&trash, " > %-12s: size=%u flags=%#x align=%u\n", reg->name, reg->size, reg->flags, reg->align);
|
||||
list_for_each_entry(reg, &pool_info[i].entry->regs, list) {
|
||||
chunk_appendf(&trash, " > %-12s: size=%u flags=%#x align=%u", reg->name, reg->size, reg->flags, reg->align);
|
||||
if (reg->file && reg->line)
|
||||
chunk_appendf(&trash, " [%s:%u]", reg->file, reg->line);
|
||||
chunk_appendf(&trash, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user