summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra/mem.c')
-rw-r--r--src/vppinfra/mem.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vppinfra/mem.c b/src/vppinfra/mem.c
index b417b8503ad..1f8b6bfe618 100644
--- a/src/vppinfra/mem.c
+++ b/src/vppinfra/mem.c
@@ -71,6 +71,30 @@ clib_mem_vm_map_shared (void *base, uword size, int fd, uword offset,
return rv;
}
+u8 *
+format_clib_mem_page_stats (u8 * s, va_list * va)
+{
+ clib_mem_page_stats_t *stats = va_arg (*va, clib_mem_page_stats_t *);
+ u32 indent = format_get_indent (s) + 2;
+
+ s = format (s, "page stats: page-size %U, total %lu, mapped %lu, "
+ "not-mapped %lu", format_log2_page_size, stats->log2_page_sz,
+ stats->total, stats->mapped, stats->not_mapped);
+
+ if (stats->unknown)
+ s = format (s, ", unknown %lu", stats->unknown);
+
+ for (int i = 0; i < CLIB_MAX_NUMAS; i++)
+ if (stats->per_numa[i])
+ s = format (s, "\n%Unuma %u: %lu pages, %U bytes",
+ format_white_space, indent, i,
+ stats->per_numa[i],
+ format_memory_size,
+ stats->per_numa[i] << stats->log2_page_sz);
+
+ return s;
+}
+
/*
* fd.io coding-style-patch-verification: ON
*