Mercurial > vba-clojure
diff src/prof/gmon.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/prof/gmon.h Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,151 @@ 1.4 +/* 1.5 + * Copyright (c) 1983, 1991, 1993, 2001 1.6 + * The Regents of the University of California. All rights reserved. 1.7 + * 1.8 + * Redistribution and use in source and binary forms, with or without 1.9 + * modification, are permitted provided that the following conditions 1.10 + * are met: 1.11 + * 1. Redistributions of source code must retain the above copyright 1.12 + * notice, this list of conditions and the following disclaimer. 1.13 + * 2. Redistributions in binary form must reproduce the above copyright 1.14 + * notice, this list of conditions and the following disclaimer in the 1.15 + * documentation and/or other materials provided with the distribution. 1.16 + * 3. Neither the name of the University nor the names of its contributors 1.17 + * may be used to endorse or promote products derived from this software 1.18 + * without specific prior written permission. 1.19 + * 1.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.30 + * SUCH DAMAGE. 1.31 + */ 1.32 +#ifndef gmon_h 1.33 +#define gmon_h 1.34 + 1.35 +#include <stdint.h> 1.36 +typedef uint32_t u32; 1.37 + 1.38 +/* Size of the 4.4BSD gmon header */ 1.39 +#define GMON_HDRSIZE_BSD44_32 (4 + 4 + 4 + 4 + 4 + (3 * 4)) 1.40 +#define GMON_HDRSIZE_BSD44_64 (8 + 8 + 4 + 4 + 4 + (3 * 4)) 1.41 + 1.42 +#if 0 /* For documentation purposes only. */ 1.43 + struct raw_phdr 1.44 + { 1.45 + char low_pc[sizeof(void *)]; /* base pc address of sample buffer */ 1.46 + char high_pc[sizeof(void *)];/* max pc address of sampled buffer */ 1.47 + char ncnt[4]; /* size of sample buffer (plus this 1.48 + header) */ 1.49 + 1.50 + char version[4]; /* version number */ 1.51 + char profrate[4]; /* profiling clock rate */ 1.52 + char spare[3*4]; /* reserved */ 1.53 + }; 1.54 +#endif 1.55 + 1.56 +#define GMONVERSION 0x00051879 1.57 + 1.58 +/* Size of the old BSD gmon header */ 1.59 +#define GMON_HDRSIZE_OLDBSD_32 (4 + 4 + 4) 1.60 + 1.61 +/* FIXME: Checking host compiler defines here means that we can't 1.62 + use a cross gprof alpha OSF. */ 1.63 +#if defined(__alpha__) && defined (__osf__) 1.64 +#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4 + 4) 1.65 +#else 1.66 +#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4) 1.67 +#endif 1.68 + 1.69 +#if 0 /* For documentation purposes only. */ 1.70 + struct old_raw_phdr 1.71 + { 1.72 + char low_pc[sizeof(void *)]; /* base pc address of sample buffer */ 1.73 + char high_pc[sizeof(void *)];/* max pc address of sampled buffer */ 1.74 + char ncnt[4]; /* size of sample buffer (plus this 1.75 + header) */ 1.76 +#if defined (__alpha__) && defined (__osf__) 1.77 + /* 1.78 + * DEC's OSF v3.0 uses 4 bytes of padding to bring the header to 1.79 + * a size that is a multiple of 8. 1.80 + */ 1.81 + char pad[4]; 1.82 +#endif 1.83 + }; 1.84 +#endif 1.85 + 1.86 +/* 1.87 + * Histogram counters are unsigned shorts: 1.88 + */ 1.89 +#define HISTCOUNTER unsigned short 1.90 + 1.91 +/* 1.92 + * Fraction of text space to allocate for histogram counters here, 1/2: 1.93 + */ 1.94 +#define HISTFRACTION 2 1.95 + 1.96 +/* 1.97 + * Fraction of text space to allocate for from hash buckets. The 1.98 + * value of HASHFRACTION is based on the minimum number of bytes of 1.99 + * separation between two subroutine call points in the object code. 1.100 + * Given MIN_SUBR_SEPARATION bytes of separation the value of 1.101 + * HASHFRACTION is calculated as: 1.102 + * 1.103 + * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1); 1.104 + * 1.105 + * For the VAX, the shortest two call sequence is: 1.106 + * 1.107 + * calls $0,(r0) 1.108 + * calls $0,(r0) 1.109 + * 1.110 + * which is separated by only three bytes, thus HASHFRACTION is 1.111 + * calculated as: 1.112 + * 1.113 + * HASHFRACTION = 3 / (2 * 2 - 1) = 1 1.114 + * 1.115 + * Note that the division above rounds down, thus if MIN_SUBR_FRACTION 1.116 + * is less than three, this algorithm will not work! 1.117 + */ 1.118 +#define HASHFRACTION 1 1.119 + 1.120 +/* 1.121 + * Percent of text space to allocate for tostructs with a minimum: 1.122 + */ 1.123 +#define ARCDENSITY 2 1.124 +#define MINARCS 50 1.125 + 1.126 +struct tostruct 1.127 + { 1.128 + u32 selfpc; 1.129 + int count; 1.130 + unsigned short link; 1.131 + }; 1.132 + 1.133 +/* 1.134 + * A raw arc, with pointers to the calling site and the called site 1.135 + * and a count. Everything is defined in terms of characters so 1.136 + * as to get a packed representation (otherwise, different compilers 1.137 + * might introduce different padding): 1.138 + */ 1.139 +#if 0 /* For documentation purposes only. */ 1.140 + struct raw_arc 1.141 + { 1.142 + char from_pc[sizeof(void *)]; 1.143 + char self_pc[sizeof(void *)]; 1.144 + char count[sizeof(long)]; 1.145 + }; 1.146 +#endif 1.147 + 1.148 +/* 1.149 + * General rounding functions: 1.150 + */ 1.151 +#define ROUNDDOWN(x,y) (((x)/(y))*(y)) 1.152 +#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) 1.153 + 1.154 +#endif /* gmon_h */