diff options
| author | David Lamparter <equinox@diac24.net> | 2018-08-30 16:44:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-30 16:44:47 +0200 |
| commit | 66a9aa8b8860d8c79d8b395eb22ccddcdebf69e6 (patch) | |
| tree | 87acadf7aab4ff94d153bdb9b47cd807f733442b /lib/memory_vty.c | |
| parent | f177317a20ff417c2dc9d719f2e1135d81ff96f8 (diff) | |
| parent | 7a153339b2ea6b9cdef3f9ce2113e27f417c6fab (diff) | |
Merge pull request #2859 from LabNConsulting/working/master/meminfo
lib: qmem show changes (header and max)
Diffstat (limited to 'lib/memory_vty.c')
| -rw-r--r-- | lib/memory_vty.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/lib/memory_vty.c b/lib/memory_vty.c index 9ee2e52ec7..73a18529a2 100644 --- a/lib/memory_vty.c +++ b/lib/memory_vty.c @@ -73,27 +73,45 @@ static int show_memory_mallinfo(struct vty *vty) static int qmem_walker(void *arg, struct memgroup *mg, struct memtype *mt) { struct vty *vty = arg; - if (!mt) + if (!mt) { vty_out(vty, "--- qmem %s ---\n", mg->name); - else { + vty_out(vty, "%-30s: %8s %-8s%s %8s %9s\n", + "Type", "Current#", " Size", +#ifdef HAVE_MALLOC_USABLE_SIZE + " Total", +#else + "", +#endif + "Max#", +#ifdef HAVE_MALLOC_USABLE_SIZE + "MaxBytes" +#else + "" +#endif + ); + } else { if (mt->n_alloc != 0) { char size[32]; snprintf(size, sizeof(size), "%6zu", mt->size); - #ifdef HAVE_MALLOC_USABLE_SIZE #define TSTR " %9zu" #define TARG , mt->total +#define TARG2 , mt->max_size #else #define TSTR "" #define TARG +#define TARG2 #endif - vty_out(vty, "%-30s: %10zu %-16s"TSTR"\n", mt->name, + vty_out(vty, "%-30s: %8zu %-8s"TSTR" %8zu"TSTR"\n", + mt->name, mt->n_alloc, mt->size == 0 ? "" : mt->size == SIZE_VAR - ? "(variably sized)" + ? "variable" : size - TARG); + TARG, + mt->n_max + TARG2); } } return 0; |
