1 | /* gmon.h,v 1.2 2004/09/14 22:27:33 bird Exp */
|
---|
2 | /** @file
|
---|
3 | * BSD
|
---|
4 | */
|
---|
5 | /*-
|
---|
6 | * Copyright (c) 1991 The Regents of the University of California.
|
---|
7 | * All rights reserved.
|
---|
8 | *
|
---|
9 | * Redistribution and use in source and binary forms, with or without
|
---|
10 | * modification, are permitted provided that the following conditions
|
---|
11 | * are met:
|
---|
12 | * 1. Redistributions of source code must retain the above copyright
|
---|
13 | * notice, this list of conditions and the following disclaimer.
|
---|
14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
15 | * notice, this list of conditions and the following disclaimer in the
|
---|
16 | * documentation and/or other materials provided with the distribution.
|
---|
17 | * 3. All advertising materials mentioning features or use of this software
|
---|
18 | * must display the following acknowledgement:
|
---|
19 | * This product includes software developed by the University of
|
---|
20 | * California, Berkeley and its contributors.
|
---|
21 | * 4. Neither the name of the University nor the names of its contributors
|
---|
22 | * may be used to endorse or promote products derived from this software
|
---|
23 | * without specific prior written permission.
|
---|
24 | *
|
---|
25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
---|
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
---|
28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
---|
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
---|
34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
35 | * SUCH DAMAGE.
|
---|
36 | *
|
---|
37 | * @(#)gmon.h 5.2 (Berkeley) 5/6/91
|
---|
38 | */
|
---|
39 |
|
---|
40 | struct phdr {
|
---|
41 | char *lpc;
|
---|
42 | char *hpc;
|
---|
43 | int ncnt;
|
---|
44 | };
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * histogram counters are unsigned shorts (according to the kernel).
|
---|
48 | * For emx, histogram counters are unsigned longs.
|
---|
49 | */
|
---|
50 | #if 1 /* emx */
|
---|
51 | #define HISTCOUNTER unsigned long
|
---|
52 | #else
|
---|
53 | #define HISTCOUNTER unsigned short
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | /*
|
---|
57 | * fraction of text space to allocate for histogram counters
|
---|
58 | * here, 1/2
|
---|
59 | */
|
---|
60 | #define HISTFRACTION 2
|
---|
61 |
|
---|
62 | /*
|
---|
63 | * Fraction of text space to allocate for from hash buckets.
|
---|
64 | * The value of HASHFRACTION is based on the minimum number of bytes
|
---|
65 | * of separation between two subroutine call points in the object code.
|
---|
66 | * Given MIN_SUBR_SEPARATION bytes of separation the value of
|
---|
67 | * HASHFRACTION is calculated as:
|
---|
68 | *
|
---|
69 | * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
|
---|
70 | *
|
---|
71 | * For the VAX, the shortest two call sequence is:
|
---|
72 | *
|
---|
73 | * calls $0,(r0)
|
---|
74 | * calls $0,(r0)
|
---|
75 | *
|
---|
76 | * which is separated by only three bytes, thus HASHFRACTION is
|
---|
77 | * calculated as:
|
---|
78 | *
|
---|
79 | * HASHFRACTION = 3 / (2 * 2 - 1) = 1
|
---|
80 | *
|
---|
81 | * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
|
---|
82 | * is less than three, this algorithm will not work!
|
---|
83 | */
|
---|
84 | #define HASHFRACTION 1
|
---|
85 |
|
---|
86 | /*
|
---|
87 | * percent of text space to allocate for tostructs
|
---|
88 | * with a minimum.
|
---|
89 | */
|
---|
90 | #define ARCDENSITY 2
|
---|
91 | #define MINARCS 50
|
---|
92 |
|
---|
93 | struct tostruct {
|
---|
94 | char *selfpc;
|
---|
95 | long count;
|
---|
96 | unsigned short link;
|
---|
97 | };
|
---|
98 |
|
---|
99 | /*
|
---|
100 | * a raw arc,
|
---|
101 | * with pointers to the calling site and the called site
|
---|
102 | * and a count.
|
---|
103 | */
|
---|
104 | struct rawarc {
|
---|
105 | unsigned long raw_frompc;
|
---|
106 | unsigned long raw_selfpc;
|
---|
107 | long raw_count;
|
---|
108 | };
|
---|
109 |
|
---|
110 | struct veryrawarc {
|
---|
111 | char raw_frompc[4];
|
---|
112 | char raw_selfpc[4];
|
---|
113 | char raw_count[4];
|
---|
114 | };
|
---|
115 |
|
---|
116 | /*
|
---|
117 | * general rounding functions.
|
---|
118 | */
|
---|
119 | #define ROUNDDOWN(x,y) (((x)/(y))*(y))
|
---|
120 | #define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
|
---|