Back to index

cell-binutils  2.17cvs20070401
gmon.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1983, 1991, 1993, 2001
00003  *      The Regents of the University of California.  All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the University nor the names of its contributors
00014  *    may be used to endorse or promote products derived from this software
00015  *    without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00027  * SUCH DAMAGE.
00028  */
00029 #ifndef gmon_h
00030 #define gmon_h
00031 
00032 /* Size of the 4.4BSD gmon header */
00033 #define GMON_HDRSIZE_BSD44_32 (4 + 4 + 4 + 4 + 4 + (3 * 4))
00034 #define GMON_HDRSIZE_BSD44_64 (8 + 8 + 4 + 4 + 4 + (3 * 4))
00035 
00036 /* *INDENT-OFF* */
00037 /* For documentation purposes only.
00038 
00039    struct raw_phdr
00040     {
00041       char low_pc[sizeof(void *)];   -- base pc address of sample buffer
00042       char high_pc[sizeof(void *)];  -- max pc address of sampled buffer
00043       char ncnt[4];              -- size of sample buffer (plus this
00044                                     header)
00045 
00046       char version[4];                  -- version number
00047       char profrate[4];                 -- profiling clock rate
00048       char spare[3*4];                  -- reserved
00049     };
00050 */
00051 /* *INDENT-ON* */
00052 
00053 #define GMONVERSION     0x00051879
00054 
00055 /* Size of the old BSD gmon header */
00056 #define GMON_HDRSIZE_OLDBSD_32 (4 + 4 + 4) 
00057 
00058 /* FIXME: Checking host compiler defines here means that we can't
00059    use a cross gprof alpha OSF.  */
00060 #if defined(__alpha__) && defined (__osf__) 
00061 #define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4 + 4)
00062 #else
00063 #define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4)
00064 #endif
00065 
00066 /* *INDENT-OFF* */
00067 /* For documentation purposes only.
00068 
00069   struct old_raw_phdr
00070     {
00071       char low_pc[sizeof(void *)];  -- base pc address of sample buffer
00072       char high_pc[sizeof(void *)]  -- max pc address of sampled buffer
00073       char ncnt[4];             -- size of sample buffer (plus this
00074                                    header)
00075 
00076       if defined (__alpha__) && defined (__osf__)
00077       char pad[4];              -- DEC's OSF v3.0 uses 4 bytes of padding
00078                                 -- to bring the header to a size that is a
00079                                 -- multiple of 8.
00080       endif
00081     };
00082 */
00083 /* *INDENT-ON* */
00084 
00085 /*
00086  * Histogram counters are unsigned shorts:
00087  */
00088 #define       HISTCOUNTER unsigned short
00089 
00090 /*
00091  * Fraction of text space to allocate for histogram counters here, 1/2:
00092  */
00093 #define       HISTFRACTION  2
00094 
00095 /*
00096  * Fraction of text space to allocate for from hash buckets.  The
00097  * value of HASHFRACTION is based on the minimum number of bytes of
00098  * separation between two subroutine call points in the object code.
00099  * Given MIN_SUBR_SEPARATION bytes of separation the value of
00100  * HASHFRACTION is calculated as:
00101  *
00102  *      HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
00103  *
00104  * For the VAX, the shortest two call sequence is:
00105  *
00106  *      calls   $0,(r0)
00107  *      calls   $0,(r0)
00108  *
00109  * which is separated by only three bytes, thus HASHFRACTION is
00110  * calculated as:
00111  *
00112  *      HASHFRACTION = 3 / (2 * 2 - 1) = 1
00113  *
00114  * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
00115  * is less than three, this algorithm will not work!
00116  */
00117 #define       HASHFRACTION 1
00118 
00119 /*
00120  * Percent of text space to allocate for tostructs with a minimum:
00121  */
00122 #define ARCDENSITY   2
00123 #define MINARCS             50
00124 
00125 struct tostruct
00126   {
00127     char *selfpc;
00128     int count;
00129     unsigned short link;
00130   };
00131 
00132 /*
00133  * A raw arc, with pointers to the calling site and the called site
00134  * and a count.  Everything is defined in terms of characters so
00135  * as to get a packed representation (otherwise, different compilers
00136  * might introduce different padding):
00137  */
00138 
00139 /* *INDENT-OFF* */
00140 /* For documentation purposes only.
00141 
00142   struct raw_arc
00143     {
00144       char from_pc[sizeof(void *)];
00145       char self_pc[sizeof(void *)];
00146       char count[sizeof(long)];
00147     };
00148 */
00149 /* *INDENT-ON* */
00150 
00151 /*
00152  * General rounding functions:
00153  */
00154 #define ROUNDDOWN(x,y)      (((x)/(y))*(y))
00155 #define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
00156 
00157 #endif /* gmon_h */