annotate src/prof/gmon.h @ 582:393b49a83394

tracked down error to set=HL-from-row-and-column
author Robert McIntyre <rlm@mit.edu>
date Sat, 01 Sep 2012 09:43:19 -0500
parents f9f4f1b99eed
children
rev   line source
rlm@1 1 /*
rlm@1 2 * Copyright (c) 1983, 1991, 1993, 2001
rlm@1 3 * The Regents of the University of California. All rights reserved.
rlm@1 4 *
rlm@1 5 * Redistribution and use in source and binary forms, with or without
rlm@1 6 * modification, are permitted provided that the following conditions
rlm@1 7 * are met:
rlm@1 8 * 1. Redistributions of source code must retain the above copyright
rlm@1 9 * notice, this list of conditions and the following disclaimer.
rlm@1 10 * 2. Redistributions in binary form must reproduce the above copyright
rlm@1 11 * notice, this list of conditions and the following disclaimer in the
rlm@1 12 * documentation and/or other materials provided with the distribution.
rlm@1 13 * 3. Neither the name of the University nor the names of its contributors
rlm@1 14 * may be used to endorse or promote products derived from this software
rlm@1 15 * without specific prior written permission.
rlm@1 16 *
rlm@1 17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
rlm@1 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
rlm@1 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
rlm@1 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
rlm@1 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
rlm@1 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
rlm@1 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
rlm@1 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
rlm@1 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
rlm@1 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
rlm@1 27 * SUCH DAMAGE.
rlm@1 28 */
rlm@1 29 #ifndef gmon_h
rlm@1 30 #define gmon_h
rlm@1 31
rlm@1 32 #include <stdint.h>
rlm@1 33 typedef uint32_t u32;
rlm@1 34
rlm@1 35 /* Size of the 4.4BSD gmon header */
rlm@1 36 #define GMON_HDRSIZE_BSD44_32 (4 + 4 + 4 + 4 + 4 + (3 * 4))
rlm@1 37 #define GMON_HDRSIZE_BSD44_64 (8 + 8 + 4 + 4 + 4 + (3 * 4))
rlm@1 38
rlm@1 39 #if 0 /* For documentation purposes only. */
rlm@1 40 struct raw_phdr
rlm@1 41 {
rlm@1 42 char low_pc[sizeof(void *)]; /* base pc address of sample buffer */
rlm@1 43 char high_pc[sizeof(void *)];/* max pc address of sampled buffer */
rlm@1 44 char ncnt[4]; /* size of sample buffer (plus this
rlm@1 45 header) */
rlm@1 46
rlm@1 47 char version[4]; /* version number */
rlm@1 48 char profrate[4]; /* profiling clock rate */
rlm@1 49 char spare[3*4]; /* reserved */
rlm@1 50 };
rlm@1 51 #endif
rlm@1 52
rlm@1 53 #define GMONVERSION 0x00051879
rlm@1 54
rlm@1 55 /* Size of the old BSD gmon header */
rlm@1 56 #define GMON_HDRSIZE_OLDBSD_32 (4 + 4 + 4)
rlm@1 57
rlm@1 58 /* FIXME: Checking host compiler defines here means that we can't
rlm@1 59 use a cross gprof alpha OSF. */
rlm@1 60 #if defined(__alpha__) && defined (__osf__)
rlm@1 61 #define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4 + 4)
rlm@1 62 #else
rlm@1 63 #define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4)
rlm@1 64 #endif
rlm@1 65
rlm@1 66 #if 0 /* For documentation purposes only. */
rlm@1 67 struct old_raw_phdr
rlm@1 68 {
rlm@1 69 char low_pc[sizeof(void *)]; /* base pc address of sample buffer */
rlm@1 70 char high_pc[sizeof(void *)];/* max pc address of sampled buffer */
rlm@1 71 char ncnt[4]; /* size of sample buffer (plus this
rlm@1 72 header) */
rlm@1 73 #if defined (__alpha__) && defined (__osf__)
rlm@1 74 /*
rlm@1 75 * DEC's OSF v3.0 uses 4 bytes of padding to bring the header to
rlm@1 76 * a size that is a multiple of 8.
rlm@1 77 */
rlm@1 78 char pad[4];
rlm@1 79 #endif
rlm@1 80 };
rlm@1 81 #endif
rlm@1 82
rlm@1 83 /*
rlm@1 84 * Histogram counters are unsigned shorts:
rlm@1 85 */
rlm@1 86 #define HISTCOUNTER unsigned short
rlm@1 87
rlm@1 88 /*
rlm@1 89 * Fraction of text space to allocate for histogram counters here, 1/2:
rlm@1 90 */
rlm@1 91 #define HISTFRACTION 2
rlm@1 92
rlm@1 93 /*
rlm@1 94 * Fraction of text space to allocate for from hash buckets. The
rlm@1 95 * value of HASHFRACTION is based on the minimum number of bytes of
rlm@1 96 * separation between two subroutine call points in the object code.
rlm@1 97 * Given MIN_SUBR_SEPARATION bytes of separation the value of
rlm@1 98 * HASHFRACTION is calculated as:
rlm@1 99 *
rlm@1 100 * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
rlm@1 101 *
rlm@1 102 * For the VAX, the shortest two call sequence is:
rlm@1 103 *
rlm@1 104 * calls $0,(r0)
rlm@1 105 * calls $0,(r0)
rlm@1 106 *
rlm@1 107 * which is separated by only three bytes, thus HASHFRACTION is
rlm@1 108 * calculated as:
rlm@1 109 *
rlm@1 110 * HASHFRACTION = 3 / (2 * 2 - 1) = 1
rlm@1 111 *
rlm@1 112 * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
rlm@1 113 * is less than three, this algorithm will not work!
rlm@1 114 */
rlm@1 115 #define HASHFRACTION 1
rlm@1 116
rlm@1 117 /*
rlm@1 118 * Percent of text space to allocate for tostructs with a minimum:
rlm@1 119 */
rlm@1 120 #define ARCDENSITY 2
rlm@1 121 #define MINARCS 50
rlm@1 122
rlm@1 123 struct tostruct
rlm@1 124 {
rlm@1 125 u32 selfpc;
rlm@1 126 int count;
rlm@1 127 unsigned short link;
rlm@1 128 };
rlm@1 129
rlm@1 130 /*
rlm@1 131 * A raw arc, with pointers to the calling site and the called site
rlm@1 132 * and a count. Everything is defined in terms of characters so
rlm@1 133 * as to get a packed representation (otherwise, different compilers
rlm@1 134 * might introduce different padding):
rlm@1 135 */
rlm@1 136 #if 0 /* For documentation purposes only. */
rlm@1 137 struct raw_arc
rlm@1 138 {
rlm@1 139 char from_pc[sizeof(void *)];
rlm@1 140 char self_pc[sizeof(void *)];
rlm@1 141 char count[sizeof(long)];
rlm@1 142 };
rlm@1 143 #endif
rlm@1 144
rlm@1 145 /*
rlm@1 146 * General rounding functions:
rlm@1 147 */
rlm@1 148 #define ROUNDDOWN(x,y) (((x)/(y))*(y))
rlm@1 149 #define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
rlm@1 150
rlm@1 151 #endif /* gmon_h */