DEBUG: sink: add name hint for memory area used by memory-backed sinks

Thanks to ("MINOR: tools: add vma_set_name() helper"), set a name hint
for user created memory-backed sinks (ring sections without backing-file)
so that they can be easily indentified in /proc/<pid>/maps.

Depending on malloc() implementation, such memory areas will normally be
merged on the heap under MMAP_THRESHOLD (128 kB by default) and will
have a dedicated memory area once the threshold is exceeded. As such, when
large enough, they will appear like this in /proc/<pid>/maps:

7b8e8ac00000-7b8e8bf13000 rw-p 00000000 00:00 0                          [anon💍myring]
This commit is contained in:
Aurelien DARRAGON 2024-05-20 15:16:10 +02:00
parent 6de0da1b54
commit 6c5869f846

View File

@ -829,6 +829,12 @@ static int sink_finalize(struct sink *sink)
ha_alert("error when trying to initialize sink buffer forwarding.\n");
err_code |= ERR_ALERT | ERR_FATAL;
}
if (!sink->store) {
/* virtual memory backed sink */
vma_set_name(ring_allocated_area(sink->ctx.ring),
ring_allocated_size(sink->ctx.ring),
"ring", sink->name);
}
}
return err_code;
}