diff options
author | svn2git <svn2git@FreeBSD.org> | 1994-07-01 08:00:00 +0000 |
---|---|---|
committer | svn2git <svn2git@FreeBSD.org> | 1994-07-01 08:00:00 +0000 |
commit | 5e0e9b99dc3fc0ecd49d929db0d57c784b66f481 (patch) | |
tree | e779b5a6edddbb949b7990751b12d6f25304ba86 /lib/libmalloc/stats.c | |
parent | a16f65c7d117419bd266c28a1901ef129a337569 (diff) |
Diffstat (limited to 'lib/libmalloc/stats.c')
-rw-r--r-- | lib/libmalloc/stats.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/libmalloc/stats.c b/lib/libmalloc/stats.c new file mode 100644 index 000000000000..05ebb48ad869 --- /dev/null +++ b/lib/libmalloc/stats.c @@ -0,0 +1,38 @@ +/* Author: Mark Moraes <moraes@csri.toronto.edu> */ + +/*LINTLIBRARY*/ + +#include "defs.h" +#include "globals.h" + +RCSID("$Id: stats.c,v 1.1 1994/03/06 22:59:53 nate Exp $") + +/* + * Dumps the distribution of allocated sizes we've gathered so far + */ +void +mal_statsdump(fd) +FILE *fd; +{ +#ifdef PROFILESIZES + int i; + char buf[128]; + + for (i = 1; i < MAXPROFILESIZE; i++) { + if(_malloc_scount[i] > 0) { + (void) sprintf(buf, "%lu: %lu\n",(ulong)i*sizeof(Word), + (ulong) _malloc_scount[i]); + (void) fputs(buf, fd); + _malloc_scount[i] = 0; + } + } + if (_malloc_scount[0] > 0) { + (void) sprintf(buf, ">= %lu: %lu\n", + (ulong) MAXPROFILESIZE * sizeof(Word), + (ulong) _malloc_scount[0]); + (void) fputs(buf, fd); + _malloc_scount[0] = 0; + } + (void) fflush(fd); +#endif /* PROFILESIZES */ +} |