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