xref: /original-bsd/sys/sys/gmon.h (revision 7e7b101a)
1 /*	gmon.h	6.1	83/07/29	*/
2 
3 struct phdr {
4     char	*lpc;
5     char	*hpc;
6     int		ncnt;
7 };
8 
9     /*
10      *	histogram counters are unsigned shorts (according to the kernel).
11      */
12 #define	HISTCOUNTER	unsigned short
13 
14     /*
15      *	fraction of text space to allocate for histogram counters
16      *	here, 1/2
17      */
18 #define	HISTFRACTION	2
19 
20     /*
21      *	Fraction of text space to allocate for from hash buckets.
22      *	The value of HASHFRACTION is based on the minimum number of bytes
23      *	of separation between two subroutine call points in the object code.
24      *	Given MIN_SUBR_SEPARATION bytes of separation the value of
25      *	HASHFRACTION is calculated as:
26      *
27      *		HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
28      *
29      *	For the VAX, the shortest two call sequence is:
30      *
31      *		calls	$0,(r0)
32      *		calls	$0,(r0)
33      *
34      *	which is separated by only three bytes, thus HASHFRACTION is
35      *	calculated as:
36      *
37      *		HASHFRACTION = 3 / (2 * 2 - 1) = 1
38      *
39      *	Note that the division above rounds down, thus if MIN_SUBR_FRACTION
40      *	is less than three, this algorithm will not work!
41      *
42      *	NB: for the kernel we assert that the shortest two call sequence is:
43      *
44      *		calls	$0,_name
45      *		calls	$0,_name
46      *
47      *	which is separated by seven bytes, thus HASHFRACTION is calculated as:
48      *
49      *		HASHFRACTION = 7 / (2 * 2 - 1) = 2
50      */
51 #define	HASHFRACTION	2
52 
53     /*
54      *	percent of text space to allocate for tostructs
55      *	with a minimum.
56      */
57 #define ARCDENSITY	2
58 #define MINARCS		50
59 
60 struct tostruct {
61     char		*selfpc;
62     long		count;
63     unsigned short	link;
64 };
65 
66     /*
67      *	a raw arc,
68      *	    with pointers to the calling site and the called site
69      *	    and a count.
70      */
71 struct rawarc {
72     unsigned long	raw_frompc;
73     unsigned long	raw_selfpc;
74     long		raw_count;
75 };
76 
77     /*
78      *	general rounding functions.
79      */
80 #define ROUNDDOWN(x,y)	(((x)/(y))*(y))
81 #define ROUNDUP(x,y)	((((x)+(y)-1)/(y))*(y))
82