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