lemoncake

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

commit 5174e98d13e5153e263fa5626fc4753700a783ac
parent 51eb7c3aba882d06d0f9030b2a77e70aa04a1e48
Author: sin <sin@2f30.org>
Date:   Fri,  2 Aug 2013 16:42:42 +0100

Print process name in the logfile

Diffstat:
Mlemoncake.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lemoncake.c b/lemoncake.c @@ -67,11 +67,16 @@ at_cmp(struct node *a, struct node *b) static void dump_stats(void) { - char buf[BUFSIZ]; + char buf[BUFSIZ], *p; int fd; fd = open("lemoncake.out", O_WRONLY | O_CREAT | O_APPEND, 0644); if (fd != -1) { + p = getenv("_"); + if (p) { + snprintf(buf, sizeof(buf), "Lemoncake stats for process: %s\n", p); + write(fd, buf, strlen(buf)); + } snprintf(buf, sizeof(buf), "nr_mmap: %lu, nr_malloc: %lu, nr_realloc: %lu, nr_free: %lu\n", ctx.nr_mmap, ctx.nr_malloc, ctx.nr_realloc, ctx.nr_free);