* gprof.h: Undefine hz.
[deliverable/binutils-gdb.git] / gprof / gprof.h
CommitLineData
3d6c6501
SEF
1/*
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.
4 *
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.
18 *
19 * @(#)gprof.h 5.9 (Berkeley) 6/1/90
20 */
21
8739c727 22#include <ansidecl.h>
9d651373 23#include "sysdep.h"
811e3c6a 24#include "bfd.h"
3d6c6501
SEF
25#include "gmon.h"
26
7508b715
ILT
27/* AIX defines hz as a macro. */
28#undef hz
29
3d6c6501
SEF
30#ifdef MACHINE_H
31# include MACHINE_H
32#else
33# if vax
34# include "vax.h"
35# endif
36# if sun
37# include "sun.h"
38# endif
39# if tahoe
40# include "tahoe.h"
41# endif
42#endif
43
44
45 /*
46 * who am i, for error messages.
47 */
48char *whoami;
49
50 /*
51 * booleans
52 */
53typedef int bool;
54#define FALSE 0
55#define TRUE 1
56
57 /*
58 * ticks per second
59 */
60long hz;
61
9d651373 62typedef unsigned short UNIT; /* unit of profiling */
3d6c6501
SEF
63char *a_outname;
64#define A_OUTNAME "a.out"
65
66char *gmonname;
67#define GMONNAME "gmon.out"
68#define GMONSUM "gmon.sum"
69
dc1d1ca5
PB
70extern int bsd_style_output;
71extern int discard_underscores;
72
3d6c6501
SEF
73 /*
74 * a constructed arc,
75 * with pointers to the namelist entry of the parent and the child,
76 * a count of how many times this arc was traversed,
77 * and pointers to the next parent of this child and
78 * the next child of this parent.
79 */
80struct arcstruct {
81 struct nl *arc_parentp; /* pointer to parent's nl entry */
82 struct nl *arc_childp; /* pointer to child's nl entry */
83 long arc_count; /* how calls from parent to child */
84 double arc_time; /* time inherited along arc */
85 double arc_childtime; /* childtime inherited along arc */
86 struct arcstruct *arc_parentlist; /* parents-of-this-child list */
87 struct arcstruct *arc_childlist; /* children-of-this-parent list */
88};
89typedef struct arcstruct arctype;
90
91 /*
92 * The symbol table;
93 * for each external in the specified file we gather
94 * its address, the number of calls and compute its share of cpu time.
95 */
96struct nl {
dc1d1ca5 97 CONST char *name; /* the name */
3d6c6501
SEF
98 unsigned long value; /* the pc entry point */
99 unsigned long svalue; /* entry point aligned to histograms */
100 double time; /* ticks in this routine */
101 double childtime; /* cumulative ticks in children */
102 long ncall; /* how many times called */
103 long selfcalls; /* how many calls to self */
104 double propfraction; /* what % of time propagates */
105 double propself; /* how much self time propagates */
106 double propchild; /* how much child time propagates */
107 bool printflag; /* should this be printed? */
108 int index; /* index in the graph list */
109 int toporder; /* graph call chain top-sort order */
110 int cycleno; /* internal number of cycle on */
111 struct nl *cyclehead; /* pointer to head of cycle */
112 struct nl *cnext; /* pointer to next member of cycle */
113 arctype *parents; /* list of caller arcs */
114 arctype *children; /* list of callee arcs */
115};
116typedef struct nl nltype;
117
118nltype *nl; /* the whole namelist */
119nltype *npe; /* the virtual end of the namelist */
120int nname; /* the number of function names */
121
122 /*
123 * flag which marks a nl entry as topologically ``busy''
124 * flag which marks a nl entry as topologically ``not_numbered''
125 */
126#define DFN_BUSY -1
127#define DFN_NAN 0
128
129 /*
130 * namelist entries for cycle headers.
131 * the number of discovered cycles.
132 */
133nltype *cyclenl; /* cycle header namelist */
134int ncycle; /* number of cycles discovered */
135
136 /*
137 * The header on the gmon.out file.
138 * gmon.out consists of one of these headers,
139 * and then an array of ncnt samples
140 * representing the discretized program counter values.
141 * this should be a struct phdr, but since everything is done
142 * as UNITs, this is in UNITs too.
143 */
144struct hdr {
145 UNIT *lowpc;
146 UNIT *highpc;
147 int ncnt;
148};
149
150struct hdr h;
151
152int debug;
153
154 /*
155 * Each discretized pc sample has
156 * a count of the number of samples in its range
157 */
158UNIT *samples;
159
160unsigned long s_lowpc; /* lowpc from the profile file */
161unsigned long s_highpc; /* highpc from the profile file */
162unsigned lowpc, highpc; /* range profiled, in UNIT's */
163unsigned sampbytes; /* number of bytes of samples */
164int nsamples; /* number of samples */
165double actime; /* accumulated time thus far for putprofline */
166double totime; /* total time for all routines */
167double printtime; /* total of time being printed */
168double scale; /* scale factor converting samples to pc
169 values: each sample covers scale bytes */
170char *strtab; /* string table in core */
171off_t ssiz; /* size of the string table */
3d6c6501
SEF
172unsigned char *textspace; /* text space of a.out in core */
173
174 /*
175 * option flags, from a to z.
176 */
177bool aflag; /* suppress static functions */
178bool bflag; /* blurbs, too */
179bool cflag; /* discovered call graph, too */
180bool dflag; /* debugging options */
181bool eflag; /* specific functions excluded */
182bool Eflag; /* functions excluded with time */
183bool fflag; /* specific functions requested */
184bool Fflag; /* functions requested with time */
185bool kflag; /* arcs to be deleted */
186bool sflag; /* sum multiple gmon.out files */
187bool zflag; /* zero time/called functions, too */
188
189 /*
190 * structure for various string lists
191 */
192struct stringlist {
193 struct stringlist *next;
194 char *string;
195};
196struct stringlist *elist;
197struct stringlist *Elist;
198struct stringlist *flist;
199struct stringlist *Flist;
200struct stringlist *kfromlist;
201struct stringlist *ktolist;
202
203 /*
204 * function declarations
205 */
206/*
207 addarc();
208*/
209int arccmp();
210arctype *arclookup();
211/*
212 asgnsamples();
213 printblurb();
214 cyclelink();
215 dfn();
216*/
217bool dfn_busy();
218/*
219 dfn_findcycle();
220*/
221bool dfn_numbered();
222/*
223 dfn_post_visit();
224 dfn_pre_visit();
225 dfn_self_cycle();
226*/
227nltype **doarcs();
228/*
229 done();
230 findcalls();
231 flatprofheader();
232 flatprofline();
233*/
234bool funcsymbol();
235/*
236 getnfile();
237 getpfile();
238 getstrtab();
239 getsymtab();
240 gettextspace();
241 gprofheader();
242 gprofline();
243 main();
244*/
245unsigned long max();
246int membercmp();
247unsigned long min();
248nltype *nllookup();
249FILE *openpfile();
250/*
251 printchildren();
252 printcycle();
253 printgprof();
254 printmembers();
255 printname();
256 printparents();
257 printprof();
258 readsamples();
259*/
dc1d1ca5 260int printnameonly();
3d6c6501
SEF
261unsigned long reladdr();
262/*
263 sortchildren();
264 sortmembers();
265 sortparents();
266 tally();
267 timecmp();
268 topcmp();
269*/
270int totalcmp();
271/*
272 valcmp();
273*/
274
275#define LESSTHAN -1
276#define EQUALTO 0
277#define GREATERTHAN 1
278
279#define DFNDEBUG 1
280#define CYCLEDEBUG 2
281#define ARCDEBUG 4
282#define TALLYDEBUG 8
283#define TIMEDEBUG 16
284#define SAMPLEDEBUG 32
285#define AOUTDEBUG 64
286#define CALLDEBUG 128
287#define LOOKUPDEBUG 256
288#define PROPDEBUG 512
289#define ANYDEBUG 1024
This page took 0.067999 seconds and 4 git commands to generate.