mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
MINOR: activity/memprofile: use resolve_dso_name() for the DSO summary
Let's simplify the code by making use of this simpler and sometimes more efficient variant.
This commit is contained in:
parent
670507a66e
commit
ead0b0154b
@ -1146,29 +1146,19 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
|
|||||||
*/
|
*/
|
||||||
for (i = max = 0; i < max_lines; i++) {
|
for (i = max = 0; i < max_lines; i++) {
|
||||||
struct memprof_stats *entry = &tmp_memstats[i];
|
struct memprof_stats *entry = &tmp_memstats[i];
|
||||||
char *p;
|
|
||||||
|
|
||||||
if (!entry->alloc_calls && !entry->free_calls)
|
if (!entry->alloc_calls && !entry->free_calls)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
chunk_reset(name_buffer);
|
chunk_reset(name_buffer);
|
||||||
if (!entry->caller)
|
if (!entry->caller)
|
||||||
chunk_printf(name_buffer, "other:");
|
chunk_printf(name_buffer, "other");
|
||||||
else
|
else
|
||||||
resolve_sym_name(name_buffer, "", entry->caller);
|
resolve_dso_name(name_buffer, "", entry->caller);
|
||||||
|
|
||||||
/* figure the DSO name (before colon) otherwise "*program*" */
|
|
||||||
p = strchr(name_buffer->area, ':');
|
|
||||||
if (p) {
|
|
||||||
*p = 0;
|
|
||||||
p = name_buffer->area;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
p = "*program*";
|
|
||||||
|
|
||||||
/* look it up among known names (0..max) */
|
/* look it up among known names (0..max) */
|
||||||
for (j = 0; j < max; j++) {
|
for (j = 0; j < max; j++) {
|
||||||
if (tmp_memstats[j].info && strcmp(p, tmp_memstats[j].info) == 0)
|
if (tmp_memstats[j].info && strcmp(name_buffer->area, tmp_memstats[j].info) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1181,7 +1171,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
|
|||||||
if (j != i) // set max to keep min caller's address
|
if (j != i) // set max to keep min caller's address
|
||||||
tmp_memstats[j].caller = (void*)-1;
|
tmp_memstats[j].caller = (void*)-1;
|
||||||
|
|
||||||
tmp_memstats[j].info = strdup(p); // may fail, but checked when used
|
tmp_memstats[j].info = strdup(name_buffer->area); // may fail, but checked when used
|
||||||
tmp_memstats[j].alloc_calls = entry->alloc_calls;
|
tmp_memstats[j].alloc_calls = entry->alloc_calls;
|
||||||
tmp_memstats[j].alloc_tot = entry->alloc_tot;
|
tmp_memstats[j].alloc_tot = entry->alloc_tot;
|
||||||
if ((1UL << entry->method) & MEMPROF_FREE_MASK) {
|
if ((1UL << entry->method) & MEMPROF_FREE_MASK) {
|
||||||
|
Loading…
Reference in New Issue
Block a user