summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/unix-formats.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-10-06 17:46:06 +0200
committerDamjan Marion <damarion@cisco.com>2020-10-06 23:47:33 +0200
commitbfa75d6b922ee15d2f0d00999fd36b03a85eda8c (patch)
treeddd1341db08ae2020c37333d31c949d883ef6bc2 /src/vppinfra/unix-formats.c
parentab1a50cf7407e31097b550226c2b6954d6371bea (diff)
vppinfra: add heap header in front of dlmalloc space
This patch adds smal header in front of dlmalloc space, and it stores some additional information about the heap. Immediate benefit of this patch is that we know the underlying page size si we can display heap page statistics / real memory usage. Type: improvement Change-Id: Ibd6989cc2f2f64630ab08734c9552e15029c5f3f Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/unix-formats.c')
-rw-r--r--src/vppinfra/unix-formats.c62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/vppinfra/unix-formats.c b/src/vppinfra/unix-formats.c
index 7059686555b..4e29bb86ddb 100644
--- a/src/vppinfra/unix-formats.c
+++ b/src/vppinfra/unix-formats.c
@@ -964,66 +964,4 @@ unformat_unix_gid (unformat_input_t * input, va_list * args)
return 0;
}
-#define MAX_NUMNODES 16
-u8 *
-format_page_map (u8 * s, va_list * args)
-{
- uword va = va_arg (*args, uword);
- uword size = va_arg (*args, uword);
- uword page_size = clib_mem_get_page_size ();
- u32 indent = format_get_indent (s);
- uword n_pages = size / page_size;
- uword pages_per_numa[MAX_NUMNODES] = { 0 };
- uword pages_not_mapped = 0;
- uword pages_unknown = 0;
- int *status = 0;
- void **ptr = 0;
- int i;
-
- s = format (s, "virtual memory start 0x%llx, size %lluk, %u pages, "
- "page size %uk", va, size / 1024, n_pages, page_size / 1024);
-
- vec_validate (status, n_pages - 1);
- vec_validate (ptr, n_pages - 1);
-
- for (i = 0; i < n_pages; i++)
- ptr[i] = uword_to_pointer (va + i * page_size, void *);
-
- if (move_pages (0, n_pages, ptr, 0, status, 0) != 0)
- {
- s = format (s, "\n%Upage information not available (errno %u)",
- format_white_space, indent + 2, errno);
- goto done;
- }
-
- for (i = 0; i < n_pages; i++)
- {
- if (status[i] >= 0 && status[i] < MAX_NUMNODES)
- pages_per_numa[status[i]]++;
- else if (status[i] == -EFAULT)
- pages_not_mapped++;
- else
- pages_unknown++;
- }
-
- for (i = 0; i < MAX_NUMNODES; i++)
- if (pages_per_numa[i])
- s = format (s, "\n%Unuma %u: %d pages, %luk", format_white_space,
- indent + 2, i, pages_per_numa[i], pages_per_numa[i] *
- page_size / 1024);
-
- s = format (s, "\n%Unot mapped: %u pages, %luk", format_white_space,
- indent + 2, pages_not_mapped, pages_not_mapped *
- page_size / 1024);
-
- if (pages_unknown)
- s = format (s, "\n%Uunknown: %u pages, %luk", format_white_space,
- indent + 2, pages_unknown, pages_unknown * page_size / 1024);
-
-done:
- vec_free (status);
- vec_free (ptr);
- return s;
-}
-
#endif /* __KERNEL__ */