2 * Copyright (c) 1983 Regents of the University of California.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that: (1) source distributions retain this entire copyright
7 * notice and comment, and (2) distributions including binaries display
8 * the following acknowledgement: ``This product includes software
9 * developed by the University of California, Berkeley and its contributors''
10 * in the documentation or other materials provided with the distribution
11 * and in all advertising materials mentioning features or use of this
12 * software. Neither the name of the University nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 * @(#)gprof.h 5.9 (Berkeley) 6/1/90
27 /* AIX defines hz as a macro. */
46 * who am i, for error messages.
54 /* These may already be defined on some systems. We could probably just
55 use the BFD versions of these, since BFD has already dealt with this
67 typedef unsigned char UNIT[2]; /* unit of profiling */
69 #define A_OUTNAME "a.out"
72 #define GMONNAME "gmon.out"
73 #define GMONSUM "gmon.sum"
75 extern int bsd_style_output;
76 extern int discard_underscores;
80 * with pointers to the namelist entry of the parent and the child,
81 * a count of how many times this arc was traversed,
82 * and pointers to the next parent of this child and
83 * the next child of this parent.
86 struct nl *arc_parentp; /* pointer to parent's nl entry */
87 struct nl *arc_childp; /* pointer to child's nl entry */
88 long arc_count; /* how calls from parent to child */
89 double arc_time; /* time inherited along arc */
90 double arc_childtime; /* childtime inherited along arc */
91 struct arcstruct *arc_parentlist; /* parents-of-this-child list */
92 struct arcstruct *arc_childlist; /* children-of-this-parent list */
94 typedef struct arcstruct arctype;
98 * for each external in the specified file we gather
99 * its address, the number of calls and compute its share of cpu time.
102 CONST char *name; /* the name */
103 unsigned long value; /* the pc entry point */
104 unsigned long svalue; /* entry point aligned to histograms */
105 double time; /* ticks in this routine */
106 double childtime; /* cumulative ticks in children */
107 long ncall; /* how many times called */
108 long selfcalls; /* how many calls to self */
109 double propfraction; /* what % of time propagates */
110 double propself; /* how much self time propagates */
111 double propchild; /* how much child time propagates */
112 bool printflag; /* should this be printed? */
113 int index; /* index in the graph list */
114 int toporder; /* graph call chain top-sort order */
115 int cycleno; /* internal number of cycle on */
116 struct nl *cyclehead; /* pointer to head of cycle */
117 struct nl *cnext; /* pointer to next member of cycle */
118 arctype *parents; /* list of caller arcs */
119 arctype *children; /* list of callee arcs */
121 typedef struct nl nltype;
123 nltype *nl; /* the whole namelist */
124 nltype *npe; /* the virtual end of the namelist */
125 int nname; /* the number of function names */
128 * flag which marks a nl entry as topologically ``busy''
129 * flag which marks a nl entry as topologically ``not_numbered''
135 * namelist entries for cycle headers.
136 * the number of discovered cycles.
138 nltype *cyclenl; /* cycle header namelist */
139 int ncycle; /* number of cycles discovered */
142 * The header on the gmon.out file.
143 * gmon.out consists of one of these headers,
144 * and then an array of ncnt samples
145 * representing the discretized program counter values.
146 * this should be a struct phdr, but since everything is done
147 * as UNITs, this is in UNITs too.
167 * Each discretized pc sample has
168 * a count of the number of samples in its range
172 unsigned long s_lowpc; /* lowpc from the profile file */
173 unsigned long s_highpc; /* highpc from the profile file */
174 unsigned lowpc, highpc; /* range profiled, in UNIT's */
175 unsigned sampbytes; /* number of bytes of samples */
176 int nsamples; /* number of samples */
177 double actime; /* accumulated time thus far for putprofline */
178 double totime; /* total time for all routines */
179 double printtime; /* total of time being printed */
180 double scale; /* scale factor converting samples to pc
181 values: each sample covers scale bytes */
182 char *strtab; /* string table in core */
183 off_t ssiz; /* size of the string table */
184 unsigned char *textspace; /* text space of a.out in core */
187 * option flags, from a to z.
189 bool aflag; /* suppress static functions */
190 bool bflag; /* blurbs, too */
191 bool cflag; /* discovered call graph, too */
192 bool dflag; /* debugging options */
193 bool eflag; /* specific functions excluded */
194 bool Eflag; /* functions excluded with time */
195 bool fflag; /* specific functions requested */
196 bool Fflag; /* functions requested with time */
197 bool kflag; /* arcs to be deleted */
198 bool sflag; /* sum multiple gmon.out files */
199 bool zflag; /* zero time/called functions, too */
202 * structure for various string lists
205 struct stringlist *next;
208 extern struct stringlist *elist;
209 extern struct stringlist *Elist;
210 extern struct stringlist *flist;
211 extern struct stringlist *Flist;
212 extern struct stringlist *kfromlist;
213 extern struct stringlist *ktolist;
216 * function declarations
222 arctype *arclookup();
273 unsigned long reladdr();
289 #define GREATERTHAN 1
296 #define SAMPLEDEBUG 32
298 #define CALLDEBUG 128
299 #define LOOKUPDEBUG 256
300 #define PROPDEBUG 512
301 #define ANYDEBUG 1024