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