xref: /onnv-gate/usr/src/cmd/sgs/gprof/common/gprof.h (revision 4538:844098db2e81)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*4538Sdamico  * Common Development and Distribution License (the "License").
6*4538Sdamico  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21211Smike_s 
220Sstevel@tonic-gate /*
23*4538Sdamico  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24211Smike_s  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef	_SGS_GPROF_H
280Sstevel@tonic-gate #define	_SGS_GPROF_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifdef	__cplusplus
330Sstevel@tonic-gate extern "C" {
340Sstevel@tonic-gate #endif
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #include <stdio.h>
370Sstevel@tonic-gate #include <stdlib.h>
380Sstevel@tonic-gate #include <string.h>
390Sstevel@tonic-gate #include <sys/types.h>
400Sstevel@tonic-gate #include <sys/stat.h>
410Sstevel@tonic-gate #include <fcntl.h>
420Sstevel@tonic-gate #include <sys/mman.h>
430Sstevel@tonic-gate #include <elf.h>
440Sstevel@tonic-gate 
450Sstevel@tonic-gate #include "sparc.h"
460Sstevel@tonic-gate #include "gelf.h"
470Sstevel@tonic-gate #include "monv.h"
48211Smike_s #include "sgs.h"
490Sstevel@tonic-gate 
500Sstevel@tonic-gate 
510Sstevel@tonic-gate /*
520Sstevel@tonic-gate  * who am i, for error messages.
530Sstevel@tonic-gate  */
540Sstevel@tonic-gate extern char	*whoami;
550Sstevel@tonic-gate 
560Sstevel@tonic-gate /*
570Sstevel@tonic-gate  * booleans
580Sstevel@tonic-gate  */
59211Smike_s typedef Boolean	bool;
600Sstevel@tonic-gate 
610Sstevel@tonic-gate /*
620Sstevel@tonic-gate  * Alignment related constants
630Sstevel@tonic-gate  */
640Sstevel@tonic-gate #define	PGSZ		4096
650Sstevel@tonic-gate #define	STRUCT_ALIGN	8
660Sstevel@tonic-gate 
670Sstevel@tonic-gate /*
680Sstevel@tonic-gate  * Macros related to structure alignment
690Sstevel@tonic-gate  */
700Sstevel@tonic-gate #define	FLOOR(x, align)	(((Address) x) & ~((align) - 1l))
710Sstevel@tonic-gate #define	CEIL(x, align)	FLOOR(((Address) x) + (align) - 1l, align)
720Sstevel@tonic-gate 
730Sstevel@tonic-gate #define	PROFHDR_SZ	(CEIL(sizeof (ProfHeader), STRUCT_ALIGN))
740Sstevel@tonic-gate #define	PROFMODLIST_SZ	(CEIL(sizeof (ProfModuleList), STRUCT_ALIGN))
750Sstevel@tonic-gate #define	PROFMOD_SZ	(CEIL(sizeof (ProfModule), STRUCT_ALIGN))
760Sstevel@tonic-gate #define	PROFBUF_SZ	(CEIL(sizeof (ProfBuffer), STRUCT_ALIGN))
770Sstevel@tonic-gate #define	PROFCGRAPH_SZ	(CEIL(sizeof (ProfCallGraph), STRUCT_ALIGN))
780Sstevel@tonic-gate #define	PROFFUNC_SZ	(CEIL(sizeof (ProfFunction), STRUCT_ALIGN))
790Sstevel@tonic-gate 
800Sstevel@tonic-gate #define	HDR_FILLER	(PROFHDR_SZ - sizeof (ProfHeader))
810Sstevel@tonic-gate #define	MODLIST_FILLER	(PROFMODLIST_SZ - sizeof (ProfModuleList))
820Sstevel@tonic-gate #define	MOD_FILLER	(PROFMOD_SZ - sizeof (ProfModule))
830Sstevel@tonic-gate #define	BUF_FILLER	(PROFBUF_SZ - sizeof (ProfBuffer))
840Sstevel@tonic-gate #define	CGRAPH_FILLER	(PROFCGRAPH_SZ - sizeof (ProfCallGraph))
850Sstevel@tonic-gate #define	FUNC_FILLER	(PROFFUNC_SZ - sizeof (ProfFunction))
860Sstevel@tonic-gate 
870Sstevel@tonic-gate /*
880Sstevel@tonic-gate  *	ticks per second
890Sstevel@tonic-gate  */
900Sstevel@tonic-gate long	hz;
910Sstevel@tonic-gate 
920Sstevel@tonic-gate typedef	short UNIT;		/* unit of profiling */
930Sstevel@tonic-gate typedef unsigned short	unsigned_UNIT; /* to remove warnings from gprof.c */
940Sstevel@tonic-gate char	*a_outname;
950Sstevel@tonic-gate char	*prog_name;	/* keep the program name for error messages */
960Sstevel@tonic-gate #define	A_OUTNAME		"a.out"
970Sstevel@tonic-gate 
980Sstevel@tonic-gate typedef unsigned long long pctype;
990Sstevel@tonic-gate typedef uint32_t pctype32;
1000Sstevel@tonic-gate typedef size_t sztype;
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate /*
1030Sstevel@tonic-gate  * Type definition for the arc count.
1040Sstevel@tonic-gate  */
1050Sstevel@tonic-gate typedef long long actype;
1060Sstevel@tonic-gate typedef int32_t actype32;
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate char	*gmonname;
1090Sstevel@tonic-gate #define	GMONNAME		"gmon.out"
1100Sstevel@tonic-gate #define	GMONSUM			"gmon.sum"
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate /*
1130Sstevel@tonic-gate  * Special symbols used for profiling of shared libraries through
1140Sstevel@tonic-gate  * the run-time linker.
1150Sstevel@tonic-gate  */
1160Sstevel@tonic-gate #define	PRF_ETEXT		"_etext"
1170Sstevel@tonic-gate #define	PRF_EXTSYM		"<external>"
1180Sstevel@tonic-gate #define	PRF_MEMTERM		"_END_OF_VIRTUAL_MEMORY"
1190Sstevel@tonic-gate #define	PRF_SYMCNT		3
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate /*
1220Sstevel@tonic-gate  * Special symbol needed to determine the program exec's end addr.
1230Sstevel@tonic-gate  * Note that since this symbol doesn't get added to the nameslist,
1240Sstevel@tonic-gate  * it doesn't have to be counted in PRF_SYMCNT
1250Sstevel@tonic-gate  */
1260Sstevel@tonic-gate #define	PRF_END			"_end"
1270Sstevel@tonic-gate 
1280Sstevel@tonic-gate /*
1290Sstevel@tonic-gate  *	blurbs on the flat and graph profiles.
1300Sstevel@tonic-gate  */
131*4538Sdamico #define	FLAT_BLURB	"/usr/share/lib/ccs/gprof.flat.blurb"
132*4538Sdamico #define	CALLG_BLURB	"/usr/share/lib/ccs/gprof.callg.blurb"
1330Sstevel@tonic-gate 
1340Sstevel@tonic-gate /*
1350Sstevel@tonic-gate  *	a raw arc,
1360Sstevel@tonic-gate  *	    with pointers to the calling site and the called site
1370Sstevel@tonic-gate  *          and a count.
1380Sstevel@tonic-gate  */
1390Sstevel@tonic-gate struct rawarc {
1400Sstevel@tonic-gate 	pctype		raw_frompc;
1410Sstevel@tonic-gate 	pctype		raw_selfpc;
1420Sstevel@tonic-gate 	actype		raw_count;
1430Sstevel@tonic-gate };
1440Sstevel@tonic-gate 
1450Sstevel@tonic-gate struct rawarc32 {
1460Sstevel@tonic-gate 	pctype32	raw_frompc;
1470Sstevel@tonic-gate 	pctype32	raw_selfpc;
1480Sstevel@tonic-gate 	actype32	raw_count;
1490Sstevel@tonic-gate };
1500Sstevel@tonic-gate 
1510Sstevel@tonic-gate /*
1520Sstevel@tonic-gate  *	a constructed arc,
1530Sstevel@tonic-gate  *	    with pointers to the namelist entry of the parent and the child,
1540Sstevel@tonic-gate  *	    a count of how many times this arc was traversed,
1550Sstevel@tonic-gate  *	    and pointers to the next parent of this child and
1560Sstevel@tonic-gate  *	    the next child of this parent.
1570Sstevel@tonic-gate  */
1580Sstevel@tonic-gate struct arcstruct {
1590Sstevel@tonic-gate     struct nl		*arc_parentp;	/* pointer to parent's nl entry */
1600Sstevel@tonic-gate     struct nl		*arc_childp;	/* pointer to child's nl entry */
1610Sstevel@tonic-gate     actype		arc_count;	/* how calls from parent to child */
1620Sstevel@tonic-gate     double		arc_time;	/* time inherited along arc */
1630Sstevel@tonic-gate     double		arc_childtime;	/* childtime inherited along arc */
1640Sstevel@tonic-gate     struct arcstruct	*arc_parentlist; /* parents-of-this-child list */
1650Sstevel@tonic-gate     struct arcstruct	*arc_childlist;	/* children-of-this-parent list */
1660Sstevel@tonic-gate };
1670Sstevel@tonic-gate typedef struct arcstruct	arctype;
1680Sstevel@tonic-gate 
1690Sstevel@tonic-gate 
1700Sstevel@tonic-gate /*
1710Sstevel@tonic-gate  * Additions for new-style gmon.out
1720Sstevel@tonic-gate  */
1730Sstevel@tonic-gate bool	old_style;			/* gmon.out versioned/non-versioned ? */
1740Sstevel@tonic-gate 
1750Sstevel@tonic-gate /*
1760Sstevel@tonic-gate  * Executable file info.
1770Sstevel@tonic-gate  *
1780Sstevel@tonic-gate  * All info that is required to identify a file or see if it has changed
1790Sstevel@tonic-gate  * relative to another file.
1800Sstevel@tonic-gate  */
1810Sstevel@tonic-gate struct fl_info {
1820Sstevel@tonic-gate 	dev_t	dev;			/* device associated with this file */
1830Sstevel@tonic-gate 	ino_t	ino;			/* i-number of this file */
1840Sstevel@tonic-gate 	time_t	mtime;			/* last modified time of this file */
1850Sstevel@tonic-gate 	off_t	size;			/* size of file */
1860Sstevel@tonic-gate };
1870Sstevel@tonic-gate typedef struct fl_info	fl_info_t;
1880Sstevel@tonic-gate 
1890Sstevel@tonic-gate /*
1900Sstevel@tonic-gate  * Saved file info.
1910Sstevel@tonic-gate  */
1920Sstevel@tonic-gate fl_info_t	aout_info;		/* saved file info for program exec */
1930Sstevel@tonic-gate fl_info_t	gmonout_info;		/* current gmonout's info */
1940Sstevel@tonic-gate 
1950Sstevel@tonic-gate 
1960Sstevel@tonic-gate /*
1970Sstevel@tonic-gate  * Module info.
1980Sstevel@tonic-gate  */
1990Sstevel@tonic-gate struct mod_info {
2000Sstevel@tonic-gate 	struct mod_info	*next;		/* ptr to next in the modules list */
2010Sstevel@tonic-gate 	char		*name;		/* name of this module */
2020Sstevel@tonic-gate 	int		id;		/* id, used while printing */
2030Sstevel@tonic-gate 	bool		active;		/* is this module active or not ? */
2040Sstevel@tonic-gate 	struct nl	*nl;		/* ptr to nameslist for this module */
2050Sstevel@tonic-gate 	struct nl	*npe;		/* virtual end of module's namelist */
2060Sstevel@tonic-gate 	sztype		nname;		/* number of funcs in this module */
2070Sstevel@tonic-gate 	GElf_Addr	txt_origin;	/* module's start as given in file */
2080Sstevel@tonic-gate 	GElf_Addr	data_end;	/* module's end addr as in file */
2090Sstevel@tonic-gate 	Address		load_base;	/* actual pcaddr where modl's loaded */
2100Sstevel@tonic-gate 	Address		load_end;	/* actual pcaddr where modl ends */
2110Sstevel@tonic-gate };
2120Sstevel@tonic-gate typedef struct mod_info	mod_info_t;
2130Sstevel@tonic-gate 
2140Sstevel@tonic-gate sztype		total_names;	/* from all modules */
2150Sstevel@tonic-gate 
2160Sstevel@tonic-gate /*
2170Sstevel@tonic-gate  * List of shared object modules. Note that this always includes the
2180Sstevel@tonic-gate  * program executable as the first element.
2190Sstevel@tonic-gate  */
2200Sstevel@tonic-gate mod_info_t	modules;
2210Sstevel@tonic-gate sztype		n_modules;
2220Sstevel@tonic-gate 
2230Sstevel@tonic-gate 
2240Sstevel@tonic-gate 
2250Sstevel@tonic-gate /*
2260Sstevel@tonic-gate  * The symbol table;
2270Sstevel@tonic-gate  * for each external in the specified file we gather
2280Sstevel@tonic-gate  * its address, the number of calls and compute its share of cpu time.
2290Sstevel@tonic-gate  */
2300Sstevel@tonic-gate struct nl {
2310Sstevel@tonic-gate     char		*name;		/* the name */
2320Sstevel@tonic-gate     mod_info_t		*module;	/* module to which this belongs */
2330Sstevel@tonic-gate     pctype		value;		/* the pc entry point */
2340Sstevel@tonic-gate     pctype		svalue;		/* entry point aligned to histograms */
2350Sstevel@tonic-gate     unsigned long	sz;		/* function size */
2360Sstevel@tonic-gate     unsigned char	syminfo;	/* sym info */
2370Sstevel@tonic-gate     size_t		nticks;		/* ticks in this routine */
2380Sstevel@tonic-gate     double		time;		/* ticks in this routine as double */
2390Sstevel@tonic-gate     double		childtime;	/* cumulative ticks in children */
2400Sstevel@tonic-gate     actype		ncall;		/* how many times called */
2410Sstevel@tonic-gate     actype		selfcalls;	/* how many calls to self */
2420Sstevel@tonic-gate     double		propfraction;	/* what % of time propagates */
2430Sstevel@tonic-gate     double		propself;	/* how much self time propagates */
2440Sstevel@tonic-gate     double		propchild;	/* how much child time propagates */
2450Sstevel@tonic-gate     bool		printflag;	/* should this be printed? */
2460Sstevel@tonic-gate     int			index;		/* index in the graph list */
2470Sstevel@tonic-gate     int			toporder;	/* graph call chain top-sort order */
2480Sstevel@tonic-gate     int			cycleno;	/* internal number of cycle on */
2490Sstevel@tonic-gate     struct nl		*cyclehead;	/* pointer to head of cycle */
2500Sstevel@tonic-gate     struct nl		*cnext;		/* pointer to next member of cycle */
2510Sstevel@tonic-gate     arctype		*parents;	/* list of caller arcs */
2520Sstevel@tonic-gate     arctype		*children;	/* list of callee arcs */
2530Sstevel@tonic-gate     unsigned long	ncallers;	/* no. of callers - dumpsum use only */
2540Sstevel@tonic-gate };
2550Sstevel@tonic-gate typedef struct nl	nltype;
2560Sstevel@tonic-gate 
2570Sstevel@tonic-gate /*
2580Sstevel@tonic-gate  *	flag which marks a nl entry as topologically ``busy''
2590Sstevel@tonic-gate  *	flag which marks a nl entry as topologically ``not_numbered''
2600Sstevel@tonic-gate  */
2610Sstevel@tonic-gate #define	DFN_BUSY	-1
2620Sstevel@tonic-gate #define	DFN_NAN		0
2630Sstevel@tonic-gate 
2640Sstevel@tonic-gate /*
2650Sstevel@tonic-gate  *	namelist entries for cycle headers.
2660Sstevel@tonic-gate  *	the number of discovered cycles.
2670Sstevel@tonic-gate  */
2680Sstevel@tonic-gate nltype	*cyclenl;		/* cycle header namelist */
2690Sstevel@tonic-gate int	ncycle;			/* number of cycles discovered */
2700Sstevel@tonic-gate 
2710Sstevel@tonic-gate /*
2720Sstevel@tonic-gate  * The header on the gmon.out file.
2730Sstevel@tonic-gate  * old-style gmon.out consists of one of these headers,
2740Sstevel@tonic-gate  * and then an array of ncnt samples
2750Sstevel@tonic-gate  * representing the discretized program counter values.
2760Sstevel@tonic-gate  *	this should be a struct phdr, but since everything is done
2770Sstevel@tonic-gate  *	as UNITs, this is in UNITs too.
2780Sstevel@tonic-gate  */
2790Sstevel@tonic-gate struct hdr {
2800Sstevel@tonic-gate 	pctype		lowpc;
2810Sstevel@tonic-gate 	pctype		highpc;
2820Sstevel@tonic-gate 	pctype		ncnt;
2830Sstevel@tonic-gate };
2840Sstevel@tonic-gate 
2850Sstevel@tonic-gate struct hdr32 {
2860Sstevel@tonic-gate 	pctype32	lowpc;
2870Sstevel@tonic-gate 	pctype32	highpc;
2880Sstevel@tonic-gate 	pctype32	ncnt;
2890Sstevel@tonic-gate };
2900Sstevel@tonic-gate 
2910Sstevel@tonic-gate struct hdr	h;		/* header of profiled data */
2920Sstevel@tonic-gate 
2930Sstevel@tonic-gate int	debug;
2940Sstevel@tonic-gate int 	number_funcs_toprint;
2950Sstevel@tonic-gate 
2960Sstevel@tonic-gate /*
2970Sstevel@tonic-gate  * Each discretized pc sample has
2980Sstevel@tonic-gate  * a count of the number of samples in its range
2990Sstevel@tonic-gate  */
3000Sstevel@tonic-gate unsigned short	*samples;
3010Sstevel@tonic-gate 
3020Sstevel@tonic-gate pctype	s_lowpc;		/* lowpc from profile file in o-s gmon.out */
3030Sstevel@tonic-gate pctype	s_highpc;		/* highpc from profile file in o-s gmon.out */
3040Sstevel@tonic-gate sztype	sampbytes;		/* number of bytes of samples in o-s gmon.out */
3050Sstevel@tonic-gate sztype	nsamples;		/* number of samples for old-style gmon.out */
3060Sstevel@tonic-gate 
3070Sstevel@tonic-gate double	actime;			/* accumulated time thus far for putprofline */
3080Sstevel@tonic-gate double	totime;			/* total time for all routines */
3090Sstevel@tonic-gate double	printtime;		/* total of time being printed */
3100Sstevel@tonic-gate double	scale;			/* scale factor converting samples to pc */
3110Sstevel@tonic-gate 				/* values: each sample covers scale bytes */
3120Sstevel@tonic-gate 				/* -- all this is for old-style gmon.out only */
3130Sstevel@tonic-gate 
3140Sstevel@tonic-gate unsigned char	*textspace;		/* text space of a.out in core */
3150Sstevel@tonic-gate bool	first_file;			/* for difference option */
3160Sstevel@tonic-gate 
3170Sstevel@tonic-gate /*
3180Sstevel@tonic-gate  * Total number of pcsamples read so far (across gmon.out's)
3190Sstevel@tonic-gate  */
3200Sstevel@tonic-gate Size	n_pcsamples;
3210Sstevel@tonic-gate 
3220Sstevel@tonic-gate /*
3230Sstevel@tonic-gate  *	option flags, from a to z.
3240Sstevel@tonic-gate  */
3250Sstevel@tonic-gate bool	aflag;				/* suppress static functions */
3260Sstevel@tonic-gate bool	bflag;				/* blurbs, too */
3270Sstevel@tonic-gate bool	Bflag;				/* big pc's (i.e. 64 bits) */
3280Sstevel@tonic-gate bool	cflag;				/* discovered call graph, too */
3290Sstevel@tonic-gate bool	Cflag;				/* gprofing c++ -- need demangling */
3300Sstevel@tonic-gate bool	dflag;				/* debugging options */
3310Sstevel@tonic-gate bool	Dflag;				/* difference option */
3320Sstevel@tonic-gate bool	eflag;				/* specific functions excluded */
3330Sstevel@tonic-gate bool	Eflag;				/* functions excluded with time */
3340Sstevel@tonic-gate bool	fflag;				/* specific functions requested */
3350Sstevel@tonic-gate bool	Fflag;				/* functions requested with time */
3360Sstevel@tonic-gate bool	lflag;				/* exclude LOCAL syms in output */
3370Sstevel@tonic-gate bool	sflag;				/* sum multiple gmon.out files */
3380Sstevel@tonic-gate bool	zflag;				/* zero time/called functions, too */
3390Sstevel@tonic-gate bool 	nflag;				/* print only n functions in report */
3400Sstevel@tonic-gate bool	rflag;				/* profiling input generated by */
3410Sstevel@tonic-gate 					/* run-time linker */
3420Sstevel@tonic-gate 
3430Sstevel@tonic-gate 
3440Sstevel@tonic-gate /*
3450Sstevel@tonic-gate  *	structure for various string lists
3460Sstevel@tonic-gate  */
3470Sstevel@tonic-gate struct stringlist {
3480Sstevel@tonic-gate     struct stringlist	*next;
3490Sstevel@tonic-gate     char		*string;
3500Sstevel@tonic-gate };
3510Sstevel@tonic-gate extern struct stringlist	*elist;
3520Sstevel@tonic-gate extern struct stringlist	*Elist;
3530Sstevel@tonic-gate extern struct stringlist	*flist;
3540Sstevel@tonic-gate extern struct stringlist	*Flist;
3550Sstevel@tonic-gate 
3560Sstevel@tonic-gate /*
3570Sstevel@tonic-gate  *	function declarations
3580Sstevel@tonic-gate  */
3590Sstevel@tonic-gate void	addlist(struct stringlist *, char *);
3600Sstevel@tonic-gate void	addarc(nltype *, nltype *, actype);
3610Sstevel@tonic-gate int	arccmp(arctype *, arctype *);
3620Sstevel@tonic-gate arctype	*arclookup(nltype *, nltype *);
3630Sstevel@tonic-gate void	printblurb(char *);
3640Sstevel@tonic-gate void	dfn(nltype *);
3650Sstevel@tonic-gate bool	dfn_busy(nltype *);
3660Sstevel@tonic-gate void	dfn_findcycle(nltype *);
3670Sstevel@tonic-gate bool	dfn_numbered(nltype *);
3680Sstevel@tonic-gate void	dfn_post_visit(nltype *);
3690Sstevel@tonic-gate void	dfn_pre_visit(nltype *);
3700Sstevel@tonic-gate void	dfn_self_cycle(nltype *);
3710Sstevel@tonic-gate nltype	**doarcs(void);
372211Smike_s void	done(void);
3730Sstevel@tonic-gate void	findcalls(nltype *, pctype, pctype);
3740Sstevel@tonic-gate void	flatprofheader(void);
3750Sstevel@tonic-gate void	flatprofline(nltype *);
3760Sstevel@tonic-gate bool	is_shared_obj(char *);
3770Sstevel@tonic-gate void	getnfile(char *);
3780Sstevel@tonic-gate void	process_namelist(mod_info_t *);
3790Sstevel@tonic-gate void	gprofheader(void);
3800Sstevel@tonic-gate void	gprofline(nltype *);
381211Smike_s int	pc_cmp(const void *arg1, const void *arg2);
3820Sstevel@tonic-gate int	membercmp(nltype *, nltype *);
3830Sstevel@tonic-gate nltype	*nllookup(mod_info_t *, pctype, pctype *);
3840Sstevel@tonic-gate bool	onlist(struct stringlist *, char *);
3850Sstevel@tonic-gate void	printchildren(nltype *);
3860Sstevel@tonic-gate void	printcycle(nltype *);
3870Sstevel@tonic-gate void	printgprof(nltype **);
3880Sstevel@tonic-gate void	printindex(void);
3890Sstevel@tonic-gate void	printmembers(nltype *);
3900Sstevel@tonic-gate void	printmodules(void);
3910Sstevel@tonic-gate void	printname(nltype *);
3920Sstevel@tonic-gate void	printparents(nltype *);
3930Sstevel@tonic-gate void	printprof(void);
3940Sstevel@tonic-gate void	sortchildren(nltype *);
3950Sstevel@tonic-gate void	sortmembers(nltype *);
3960Sstevel@tonic-gate void	sortparents(nltype *);
397211Smike_s int	timecmp(const void *arg1, const void *arg2);
398211Smike_s int	totalcmp(const void *arg1, const void *arg2);
3990Sstevel@tonic-gate 
4000Sstevel@tonic-gate #define	LESSTHAN	-1
4010Sstevel@tonic-gate #define	EQUALTO		0
4020Sstevel@tonic-gate #define	GREATERTHAN	1
4030Sstevel@tonic-gate 
4040Sstevel@tonic-gate /*
4050Sstevel@tonic-gate  * Macros related to debug messages.
4060Sstevel@tonic-gate  */
4070Sstevel@tonic-gate #define	DFNDEBUG	0x0001
4080Sstevel@tonic-gate #define	CYCLEDEBUG	0x0002
4090Sstevel@tonic-gate #define	ARCDEBUG	0x0004
4100Sstevel@tonic-gate #define	TALLYDEBUG	0x0008
4110Sstevel@tonic-gate #define	TIMEDEBUG	0x0010
4120Sstevel@tonic-gate #define	SAMPLEDEBUG	0x0020
4130Sstevel@tonic-gate #define	ELFDEBUG	0x0040
4140Sstevel@tonic-gate #define	CALLSDEBUG	0x0080
4150Sstevel@tonic-gate #define	LOOKUPDEBUG	0x0100
4160Sstevel@tonic-gate #define	PROPDEBUG	0x0200
4170Sstevel@tonic-gate #define	ANYDEBUG	0x0400
4180Sstevel@tonic-gate 
4190Sstevel@tonic-gate #define	MONOUTDEBUG	0x0800
4200Sstevel@tonic-gate #define	MODULEDEBUG	0x1000
4210Sstevel@tonic-gate #define	CGRAPHDEBUG	0x2000
4220Sstevel@tonic-gate #define	PCSMPLDEBUG	0x4000
4230Sstevel@tonic-gate 
4240Sstevel@tonic-gate #ifdef	__cplusplus
4250Sstevel@tonic-gate }
4260Sstevel@tonic-gate #endif
4270Sstevel@tonic-gate 
4280Sstevel@tonic-gate #endif	/* _SGS_GPROF_H */
429