summaryrefslogtreecommitdiffstats
path: root/lib/memory.h
diff options
context:
space:
mode:
authorpaul <paul>2006-03-30 13:53:59 +0000
committerpaul <paul>2006-03-30 13:53:59 +0000
commit62dab5da7a6c19aff41aaf505c47125a0000004e (patch)
tree441cb12686b730c82d0dd3d17f7d9d6b59ce9408 /lib/memory.h
parent8306d1a81627d3aff32ff7d773560b12b769eb67 (diff)
downloadquagga-62dab5da7a6c19aff41aaf505c47125a0000004e.tar.bz2
quagga-62dab5da7a6c19aff41aaf505c47125a0000004e.tar.xz
[lib/memory] Add mallinfo support
2006-02-15 Paul Jakma <paul.jakma@sun.com> * configure.ac: Check for mallinfo, being careful to link test so we can detect things like umem being used (which doesn't provide a mallinfo). * lib/memory.c: (mtype_memstr) new helper function to return human friendly string for a byte count. (mtype_stats_alloc) new function, for users to retrieve number of objects allocated. (show_memory_mallinfo) New function, show mallinfo statistics if available. (show_memory_all_cmd) Call show_memory_mallinfo, if mallinfo is available. * lib/memory.h: Export mtype_memstr and mtype_stats_alloc. Provide a define for a reasonable buffer size for mtype_memstr.
Diffstat (limited to 'lib/memory.h')
-rw-r--r--lib/memory.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/memory.h b/lib/memory.h
index ef20b8c9..071f394e 100644
--- a/lib/memory.h
+++ b/lib/memory.h
@@ -79,4 +79,10 @@ extern char *mtype_zstrdup (const char *file, int line, int type,
const char *str);
extern void memory_init (void);
+/* return number of allocations outstanding for the type */
+extern unsigned long mtype_stats_alloc (int);
+
+/* Human friendly string for given byte count */
+#define MTYPE_MEMSTR_LEN 20
+extern const char *mtype_memstr (char *, size_t, unsigned long);
#endif /* _ZEBRA_MEMORY_H */