lemoncake

rbtree based memory allocator
git clone git://git.2f30.org/lemoncake.git
Log | Files | Refs | README | LICENSE

commit 146817d152c4279e0d21eca1289b6c321cfdb65d
parent 40c65a23673ffab2eae76fa3d2ba0104ed8a9751
Author: sin <sin@2f30.org>
Date:   Sun Aug  4 17:30:05 +0100

Print number of sbrk calls

Diffstat:
lemoncake.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/lemoncake.c b/lemoncake.c @@ -19,6 +19,8 @@ enum { ALIGN = 4 * sizeof(size_t) }; static void dumpstats(void); struct lemon_stats { + /* # of sbrk calls */ + unsigned long nr_sbrk; /* # of mmap calls */ unsigned long nr_mmap; /* # of malloc calls */ @@ -94,6 +96,7 @@ alloc_object(size_t siz) return NULL; p = base; p = (void *)(((uintptr_t)p + ALIGN) & ~(ALIGN - 1)); + st.nr_sbrk++; return p; } @@ -412,6 +415,7 @@ dumpstats(void) p = getenv("_"); if (p) writelog(fd, "*** Lemoncake stats for process: %s ***\n", p); + writelog(fd, "Number of sbrk calls: %lu\n", st.nr_sbrk); writelog(fd, "Number of mmap calls: %lu\n", st.nr_mmap); writelog(fd, "Number of malloc calls: %lu\n", st.nr_malloc); writelog(fd, "Number of realloc calls: %lu\n", st.nr_realloc);