File: stats.c

package info (click to toggle)
zmailer 2.99.51.52pre3-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 16,596 kB
  • ctags: 7,422
  • sloc: ansic: 90,470; sh: 3,608; makefile: 2,784; perl: 1,585; python: 115; awk: 22
file content (38 lines) | stat: -rw-r--r-- 814 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*  Author: Mark Moraes <moraes@csri.toronto.edu> */

/*LINTLIBRARY*/

#include "defs.h"
#include "globals.h"

RCSID("$Id: stats.c,v 1.1.1.1 1998/02/10 21:01:46 mea Exp $")

/*
 *  Dumps the distribution of allocated sizes we've gathered so far
 */
void
mal_statsdump(fp)
FILE *fp;
{
#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, fp);
			_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, fp);
		_malloc_scount[0] = 0;
	}
	(void) fflush(fp);
#endif /* PROFILESIZES */
}