17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
56729865damico * Common Development and Distribution License (the "License").
66729865damico * You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate *
87c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate * See the License for the specific language governing permissions
117c478bdstevel@tonic-gate * and limitations under the License.
127c478bdstevel@tonic-gate *
137c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate *
197c478bdstevel@tonic-gate * CDDL HEADER END
207c478bdstevel@tonic-gate */
2192ed178mike_s
227c478bdstevel@tonic-gate/*
236729865damico * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
2492ed178mike_s * Use is subject to license terms.
257c478bdstevel@tonic-gate */
267c478bdstevel@tonic-gate
277c478bdstevel@tonic-gate#ifndef	_SGS_GPROF_H
287c478bdstevel@tonic-gate#define	_SGS_GPROF_H
297c478bdstevel@tonic-gate
307c478bdstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bdstevel@tonic-gate
327c478bdstevel@tonic-gate#ifdef	__cplusplus
337c478bdstevel@tonic-gateextern "C" {
347c478bdstevel@tonic-gate#endif
357c478bdstevel@tonic-gate
367c478bdstevel@tonic-gate#include <stdio.h>
377c478bdstevel@tonic-gate#include <stdlib.h>
387c478bdstevel@tonic-gate#include <string.h>
397c478bdstevel@tonic-gate#include <sys/types.h>
407c478bdstevel@tonic-gate#include <sys/stat.h>
417c478bdstevel@tonic-gate#include <fcntl.h>
427c478bdstevel@tonic-gate#include <sys/mman.h>
437c478bdstevel@tonic-gate#include <elf.h>
447c478bdstevel@tonic-gate
457c478bdstevel@tonic-gate#include "sparc.h"
467c478bdstevel@tonic-gate#include "gelf.h"
477c478bdstevel@tonic-gate#include "monv.h"
4892ed178mike_s#include "sgs.h"
497c478bdstevel@tonic-gate
507c478bdstevel@tonic-gate
517c478bdstevel@tonic-gate/*
527c478bdstevel@tonic-gate * who am i, for error messages.
537c478bdstevel@tonic-gate */
547c478bdstevel@tonic-gateextern char	*whoami;
557c478bdstevel@tonic-gate
567c478bdstevel@tonic-gate/*
577c478bdstevel@tonic-gate * booleans
587c478bdstevel@tonic-gate */
5992ed178mike_stypedef Boolean	bool;
607c478bdstevel@tonic-gate
617c478bdstevel@tonic-gate/*
627c478bdstevel@tonic-gate * Alignment related constants
637c478bdstevel@tonic-gate */
647c478bdstevel@tonic-gate#define	PGSZ		4096
657c478bdstevel@tonic-gate#define	STRUCT_ALIGN	8
667c478bdstevel@tonic-gate
677c478bdstevel@tonic-gate/*
687c478bdstevel@tonic-gate * Macros related to structure alignment
697c478bdstevel@tonic-gate */
707c478bdstevel@tonic-gate#define	FLOOR(x, align)	(((Address) x) & ~((align) - 1l))
717c478bdstevel@tonic-gate#define	CEIL(x, align)	FLOOR(((Address) x) + (align) - 1l, align)
727c478bdstevel@tonic-gate
737c478bdstevel@tonic-gate#define	PROFHDR_SZ	(CEIL(sizeof (ProfHeader), STRUCT_ALIGN))
747c478bdstevel@tonic-gate#define	PROFMODLIST_SZ	(CEIL(sizeof (ProfModuleList), STRUCT_ALIGN))
757c478bdstevel@tonic-gate#define	PROFMOD_SZ	(CEIL(sizeof (ProfModule), STRUCT_ALIGN))
767c478bdstevel@tonic-gate#define	PROFBUF_SZ	(CEIL(sizeof (ProfBuffer), STRUCT_ALIGN))
777c478bdstevel@tonic-gate#define	PROFCGRAPH_SZ	(CEIL(sizeof (ProfCallGraph), STRUCT_ALIGN))
787c478bdstevel@tonic-gate#define	PROFFUNC_SZ	(CEIL(sizeof (ProfFunction), STRUCT_ALIGN))
797c478bdstevel@tonic-gate
807c478bdstevel@tonic-gate#define	HDR_FILLER	(PROFHDR_SZ - sizeof (ProfHeader))
817c478bdstevel@tonic-gate#define	MODLIST_FILLER	(PROFMODLIST_SZ - sizeof (ProfModuleList))
827c478bdstevel@tonic-gate#define	MOD_FILLER	(PROFMOD_SZ - sizeof (ProfModule))
837c478bdstevel@tonic-gate#define	BUF_FILLER	(PROFBUF_SZ - sizeof (ProfBuffer))
847c478bdstevel@tonic-gate#define	CGRAPH_FILLER	(PROFCGRAPH_SZ - sizeof (ProfCallGraph))
857c478bdstevel@tonic-gate#define	FUNC_FILLER	(PROFFUNC_SZ - sizeof (ProfFunction))
867c478bdstevel@tonic-gate
877c478bdstevel@tonic-gate/*
887c478bdstevel@tonic-gate *	ticks per second
897c478bdstevel@tonic-gate */
907c478bdstevel@tonic-gatelong	hz;
917c478bdstevel@tonic-gate
927c478bdstevel@tonic-gatetypedef	short UNIT;		/* unit of profiling */
937c478bdstevel@tonic-gatetypedef unsigned short	unsigned_UNIT; /* to remove warnings from gprof.c */
947c478bdstevel@tonic-gatechar	*a_outname;
957c478bdstevel@tonic-gatechar	*prog_name;	/* keep the program name for error messages */
967c478bdstevel@tonic-gate#define	A_OUTNAME		"a.out"
977c478bdstevel@tonic-gate
987c478bdstevel@tonic-gatetypedef unsigned long long pctype;
997c478bdstevel@tonic-gatetypedef uint32_t pctype32;
1007c478bdstevel@tonic-gatetypedef size_t sztype;
1017c478bdstevel@tonic-gate
1027c478bdstevel@tonic-gate/*
1037c478bdstevel@tonic-gate * Type definition for the arc count.
1047c478bdstevel@tonic-gate */
1057c478bdstevel@tonic-gatetypedef long long actype;
1067c478bdstevel@tonic-gatetypedef int32_t actype32;
1077c478bdstevel@tonic-gate
1087c478bdstevel@tonic-gatechar	*gmonname;
1097c478bdstevel@tonic-gate#define	GMONNAME		"gmon.out"
1107c478bdstevel@tonic-gate#define	GMONSUM			"gmon.sum"
1117c478bdstevel@tonic-gate
1127c478bdstevel@tonic-gate/*
1137c478bdstevel@tonic-gate * Special symbols used for profiling of shared libraries through
1147c478bdstevel@tonic-gate * the run-time linker.
1157c478bdstevel@tonic-gate */
1167c478bdstevel@tonic-gate#define	PRF_ETEXT		"_etext"
1177c478bdstevel@tonic-gate#define	PRF_EXTSYM		"<external>"
1187c478bdstevel@tonic-gate#define	PRF_MEMTERM		"_END_OF_VIRTUAL_MEMORY"
1197c478bdstevel@tonic-gate#define	PRF_SYMCNT		3
1207c478bdstevel@tonic-gate
1217c478bdstevel@tonic-gate/*
1227c478bdstevel@tonic-gate * Special symbol needed to determine the program exec's end addr.
1237c478bdstevel@tonic-gate * Note that since this symbol doesn't get added to the nameslist,
1247c478bdstevel@tonic-gate * it doesn't have to be counted in PRF_SYMCNT
1257c478bdstevel@tonic-gate */
1267c478bdstevel@tonic-gate#define	PRF_END			"_end"
1277c478bdstevel@tonic-gate
1287c478bdstevel@tonic-gate/*
1297c478bdstevel@tonic-gate *	blurbs on the flat and graph profiles.
1307c478bdstevel@tonic-gate */
1316729865damico#define	FLAT_BLURB	"/usr/share/lib/ccs/gprof.flat.blurb"
1326729865damico#define	CALLG_BLURB	"/usr/share/lib/ccs/gprof.callg.blurb"
1337c478bdstevel@tonic-gate
1347c478bdstevel@tonic-gate/*
1357c478bdstevel@tonic-gate *	a raw arc,
1367c478bdstevel@tonic-gate *	    with pointers to the calling site and the called site
1377c478bdstevel@tonic-gate *          and a count.
1387c478bdstevel@tonic-gate */
1397c478bdstevel@tonic-gatestruct rawarc {
1407c478bdstevel@tonic-gate	pctype		raw_frompc;
1417c478bdstevel@tonic-gate	pctype		raw_selfpc;
1427c478bdstevel@tonic-gate	actype		raw_count;
1437c478bdstevel@tonic-gate};
1447c478bdstevel@tonic-gate
1457c478bdstevel@tonic-gatestruct rawarc32 {
1467c478bdstevel@tonic-gate	pctype32	raw_frompc;
1477c478bdstevel@tonic-gate	pctype32	raw_selfpc;
1487c478bdstevel@tonic-gate	actype32	raw_count;
1497c478bdstevel@tonic-gate};
1507c478bdstevel@tonic-gate
1517c478bdstevel@tonic-gate/*
1527c478bdstevel@tonic-gate *	a constructed arc,
1537c478bdstevel@tonic-gate *	    with pointers to the namelist entry of the parent and the child,
1547c478bdstevel@tonic-gate *	    a count of how many times this arc was traversed,
1557c478bdstevel@tonic-gate *	    and pointers to the next parent of this child and
1567c478bdstevel@tonic-gate *	    the next child of this parent.
1577c478bdstevel@tonic-gate */
1587c478bdstevel@tonic-gatestruct arcstruct {
1597c478bdstevel@tonic-gate    struct nl		*arc_parentp;	/* pointer to parent's nl entry */
1607c478bdstevel@tonic-gate    struct nl		*arc_childp;	/* pointer to child's nl entry */
1617c478bdstevel@tonic-gate    actype		arc_count;	/* how calls from parent to child */
1627c478bdstevel@tonic-gate    double		arc_time;	/* time inherited along arc */
1637c478bdstevel@tonic-gate    double		arc_childtime;	/* childtime inherited along arc */
1647c478bdstevel@tonic-gate    struct arcstruct	*arc_parentlist; /* parents-of-this-child list */
1657c478bdstevel@tonic-gate    struct arcstruct	*arc_childlist;	/* children-of-this-parent list */
1667c478bdstevel@tonic-gate};
1677c478bdstevel@tonic-gatetypedef struct arcstruct	arctype;
1687c478bdstevel@tonic-gate
1697c478bdstevel@tonic-gate
1707c478bdstevel@tonic-gate/*
1717c478bdstevel@tonic-gate * Additions for new-style gmon.out
1727c478bdstevel@tonic-gate */
1737c478bdstevel@tonic-gatebool	old_style;			/* gmon.out versioned/non-versioned ? */
1747c478bdstevel@tonic-gate
1757c478bdstevel@tonic-gate/*
1767c478bdstevel@tonic-gate * Executable file info.
1777c478bdstevel@tonic-gate *
1787c478bdstevel@tonic-gate * All info that is required to identify a file or see if it has changed
1797c478bdstevel@tonic-gate * relative to another file.
1807c478bdstevel@tonic-gate */
1817c478bdstevel@tonic-gatestruct fl_info {
1827c478bdstevel@tonic-gate	dev_t	dev;			/* device associated with this file */
1837c478bdstevel@tonic-gate	ino_t	ino;			/* i-number of this file */
1847c478bdstevel@tonic-gate	time_t	mtime;			/* last modified time of this file */
1857c478bdstevel@tonic-gate	off_t	size;			/* size of file */
1867c478bdstevel@tonic-gate};
1877c478bdstevel@tonic-gatetypedef struct fl_info	fl_info_t;
1887c478bdstevel@tonic-gate
1897c478bdstevel@tonic-gate/*
1907c478bdstevel@tonic-gate * Saved file info.
1917c478bdstevel@tonic-gate */
1927c478bdstevel@tonic-gatefl_info_t	aout_info;		/* saved file info for program exec */
1937c478bdstevel@tonic-gatefl_info_t	gmonout_info;		/* current gmonout's info */
1947c478bdstevel@tonic-gate
1957c478bdstevel@tonic-gate
1967c478bdstevel@tonic-gate/*
1977c478bdstevel@tonic-gate * Module info.
1987c478bdstevel@tonic-gate */
1997c478bdstevel@tonic-gatestruct mod_info {
2007c478bdstevel@tonic-gate	struct mod_info	*next;		/* ptr to next in the modules list */
2017c478bdstevel@tonic-gate	char		*name;		/* name of this module */
2027c478bdstevel@tonic-gate	int		id;		/* id, used while printing */
2037c478bdstevel@tonic-gate	bool		active;		/* is this module active or not ? */
2047c478bdstevel@tonic-gate	struct nl	*nl;		/* ptr to nameslist for this module */
2057c478bdstevel@tonic-gate	struct nl	*npe;		/* virtual end of module's namelist */
2067c478bdstevel@tonic-gate	sztype		nname;		/* number of funcs in this module */
2077c478bdstevel@tonic-gate	GElf_Addr	txt_origin;	/* module's start as given in file */
2087c478bdstevel@tonic-gate	GElf_Addr	data_end;	/* module's end addr as in file */
2097c478bdstevel@tonic-gate	Address		load_base;	/* actual pcaddr where modl's loaded */
2107c478bdstevel@tonic-gate	Address		load_end;	/* actual pcaddr where modl ends */
2117c478bdstevel@tonic-gate};
2127c478bdstevel@tonic-gatetypedef struct mod_info	mod_info_t;
2137c478bdstevel@tonic-gate
2147c478bdstevel@tonic-gatesztype		total_names;	/* from all modules */
2157c478bdstevel@tonic-gate
2167c478bdstevel@tonic-gate/*
2177c478bdstevel@tonic-gate * List of shared object modules. Note that this always includes the
2187c478bdstevel@tonic-gate * program executable as the first element.
2197c478bdstevel@tonic-gate */
2207c478bdstevel@tonic-gatemod_info_t	modules;
2217c478bdstevel@tonic-gatesztype		n_modules;
2227c478bdstevel@tonic-gate
2237c478bdstevel@tonic-gate
2247c478bdstevel@tonic-gate
2257c478bdstevel@tonic-gate/*
2267c478bdstevel@tonic-gate * The symbol table;
2277c478bdstevel@tonic-gate * for each external in the specified file we gather
2287c478bdstevel@tonic-gate * its address, the number of calls and compute its share of cpu time.
2297c478bdstevel@tonic-gate */
2307c478bdstevel@tonic-gatestruct nl {
2317c478bdstevel@tonic-gate    char		*name;		/* the name */
2327c478bdstevel@tonic-gate    mod_info_t		*module;	/* module to which this belongs */
2337c478bdstevel@tonic-gate    pctype		value;		/* the pc entry point */
2347c478bdstevel@tonic-gate    pctype		svalue;		/* entry point aligned to histograms */
2357c478bdstevel@tonic-gate    unsigned long	sz;		/* function size */
2367c478bdstevel@tonic-gate    unsigned char	syminfo;	/* sym info */
2377c478bdstevel@tonic-gate    size_t		nticks;		/* ticks in this routine */
2387c478bdstevel@tonic-gate    double		time;		/* ticks in this routine as double */
2397c478bdstevel@tonic-gate    double		childtime;	/* cumulative ticks in children */
2407c478bdstevel@tonic-gate    actype		ncall;		/* how many times called */
2417c478bdstevel@tonic-gate    actype		selfcalls;	/* how many calls to self */
2427c478bdstevel@tonic-gate    double		propfraction;	/* what % of time propagates */
2437c478bdstevel@tonic-gate    double		propself;	/* how much self time propagates */
2447c478bdstevel@tonic-gate    double		propchild;	/* how much child time propagates */
2457c478bdstevel@tonic-gate    bool		printflag;	/* should this be printed? */
2467c478bdstevel@tonic-gate    int			index;		/* index in the graph list */
2477c478bdstevel@tonic-gate    int			toporder;	/* graph call chain top-sort order */
2487c478bdstevel@tonic-gate    int			cycleno;	/* internal number of cycle on */
2497c478bdstevel@tonic-gate    struct nl		*cyclehead;	/* pointer to head of cycle */
2507c478bdstevel@tonic-gate    struct nl		*cnext;		/* pointer to next member of cycle */
2517c478bdstevel@tonic-gate    arctype		*parents;	/* list of caller arcs */
2527c478bdstevel@tonic-gate    arctype		*children;	/* list of callee arcs */
2537c478bdstevel@tonic-gate    unsigned long	ncallers;	/* no. of callers - dumpsum use only */
2547c478bdstevel@tonic-gate};
2557c478bdstevel@tonic-gatetypedef struct nl	nltype;
2567c478bdstevel@tonic-gate
2577c478bdstevel@tonic-gate/*
2587c478bdstevel@tonic-gate *	flag which marks a nl entry as topologically ``busy''
2597c478bdstevel@tonic-gate *	flag which marks a nl entry as topologically ``not_numbered''
2607c478bdstevel@tonic-gate */
2617c478bdstevel@tonic-gate#define	DFN_BUSY	-1
2627c478bdstevel@tonic-gate#define	DFN_NAN		0
2637c478bdstevel@tonic-gate
2647c478bdstevel@tonic-gate/*
2657c478bdstevel@tonic-gate *	namelist entries for cycle headers.
2667c478bdstevel@tonic-gate *	the number of discovered cycles.
2677c478bdstevel@tonic-gate */
2687c478bdstevel@tonic-gatenltype	*cyclenl;		/* cycle header namelist */
2697c478bdstevel@tonic-gateint	ncycle;			/* number of cycles discovered */
2707c478bdstevel@tonic-gate
2717c478bdstevel@tonic-gate/*
2727c478bdstevel@tonic-gate * The header on the gmon.out file.
2737c478bdstevel@tonic-gate * old-style gmon.out consists of one of these headers,
2747c478bdstevel@tonic-gate * and then an array of ncnt samples
2757c478bdstevel@tonic-gate * representing the discretized program counter values.
2767c478bdstevel@tonic-gate *	this should be a struct phdr, but since everything is done
2777c478bdstevel@tonic-gate *	as UNITs, this is in UNITs too.
2787c478bdstevel@tonic-gate */
2797c478bdstevel@tonic-gatestruct hdr {
2807c478bdstevel@tonic-gate	pctype		lowpc;
2817c478bdstevel@tonic-gate	pctype		highpc;
2827c478bdstevel@tonic-gate	pctype		ncnt;
2837c478bdstevel@tonic-gate};
2847c478bdstevel@tonic-gate
2857c478bdstevel@tonic-gatestruct hdr32 {
2867c478bdstevel@tonic-gate	pctype32	lowpc;
2877c478bdstevel@tonic-gate	pctype32	highpc;
2887c478bdstevel@tonic-gate	pctype32	ncnt;
2897c478bdstevel@tonic-gate};
2907c478bdstevel@tonic-gate
2917c478bdstevel@tonic-gatestruct hdr	h;		/* header of profiled data */
2927c478bdstevel@tonic-gate
2937c478bdstevel@tonic-gateint	debug;
2947c478bdstevel@tonic-gateint 	number_funcs_toprint;
2957c478bdstevel@tonic-gate
2967c478bdstevel@tonic-gate/*
2977c478bdstevel@tonic-gate * Each discretized pc sample has
2987c478bdstevel@tonic-gate * a count of the number of samples in its range
2997c478bdstevel@tonic-gate */
3007c478bdstevel@tonic-gateunsigned short	*samples;
3017c478bdstevel@tonic-gate
3027c478bdstevel@tonic-gatepctype	s_lowpc;		/* lowpc from profile file in o-s gmon.out */
3037c478bdstevel@tonic-gatepctype	s_highpc;		/* highpc from profile file in o-s gmon.out */
3047c478bdstevel@tonic-gatesztype	sampbytes;		/* number of bytes of samples in o-s gmon.out */
3057c478bdstevel@tonic-gatesztype	nsamples;		/* number of samples for old-style gmon.out */
3067c478bdstevel@tonic-gate
3077c478bdstevel@tonic-gatedouble	actime;			/* accumulated time thus far for putprofline */
3087c478bdstevel@tonic-gatedouble	totime;			/* total time for all routines */
3097c478bdstevel@tonic-gatedouble	printtime;		/* total of time being printed */
3107c478bdstevel@tonic-gatedouble	scale;			/* scale factor converting samples to pc */
3117c478bdstevel@tonic-gate				/* values: each sample covers scale bytes */
3127c478bdstevel@tonic-gate				/* -- all this is for old-style gmon.out only */
3137c478bdstevel@tonic-gate
3147c478bdstevel@tonic-gateunsigned char	*textspace;		/* text space of a.out in core */
3157c478bdstevel@tonic-gatebool	first_file;			/* for difference option */
3167c478bdstevel@tonic-gate
3177c478bdstevel@tonic-gate/*
3187c478bdstevel@tonic-gate * Total number of pcsamples read so far (across gmon.out's)
3197c478bdstevel@tonic-gate */
3207c478bdstevel@tonic-gateSize	n_pcsamples;
3217c478bdstevel@tonic-gate
3227c478bdstevel@tonic-gate/*
3237c478bdstevel@tonic-gate *	option flags, from a to z.
3247c478bdstevel@tonic-gate */
3257c478bdstevel@tonic-gatebool	aflag;				/* suppress static functions */
3267c478bdstevel@tonic-gatebool	bflag;				/* blurbs, too */
3277c478bdstevel@tonic-gatebool	Bflag;				/* big pc's (i.e. 64 bits) */
3287c478bdstevel@tonic-gatebool	cflag;				/* discovered call graph, too */
3297c478bdstevel@tonic-gatebool	Cflag;				/* gprofing c++ -- need demangling */
3307c478bdstevel@tonic-gatebool	dflag;				/* debugging options */
3317c478bdstevel@tonic-gatebool	Dflag;				/* difference option */
3327c478bdstevel@tonic-gatebool	eflag;				/* specific functions excluded */
3337c478bdstevel@tonic-gatebool	Eflag;				/* functions excluded with time */
3347c478bdstevel@tonic-gatebool	fflag;				/* specific functions requested */
3357c478bdstevel@tonic-gatebool	Fflag;				/* functions requested with time */
3367c478bdstevel@tonic-gatebool	lflag;				/* exclude LOCAL syms in output */
3377c478bdstevel@tonic-gatebool	sflag;				/* sum multiple gmon.out files */
3387c478bdstevel@tonic-gatebool	zflag;				/* zero time/called functions, too */
3397c478bdstevel@tonic-gatebool 	nflag;				/* print only n functions in report */
3407c478bdstevel@tonic-gatebool	rflag;				/* profiling input generated by */
3417c478bdstevel@tonic-gate					/* run-time linker */
3427c478bdstevel@tonic-gate
3437c478bdstevel@tonic-gate
3447c478bdstevel@tonic-gate/*
3457c478bdstevel@tonic-gate *	structure for various string lists
3467c478bdstevel@tonic-gate */
3477c478bdstevel@tonic-gatestruct stringlist {
3487c478bdstevel@tonic-gate    struct stringlist	*next;
3497c478bdstevel@tonic-gate    char		*string;
3507c478bdstevel@tonic-gate};
3517c478bdstevel@tonic-gateextern struct stringlist	*elist;
3527c478bdstevel@tonic-gateextern struct stringlist	*Elist;
3537c478bdstevel@tonic-gateextern struct stringlist	*flist;
3547c478bdstevel@tonic-gateextern struct stringlist	*Flist;
3557c478bdstevel@tonic-gate
3567c478bdstevel@tonic-gate/*
3577c478bdstevel@tonic-gate *	function declarations
3587c478bdstevel@tonic-gate */
3597c478bdstevel@tonic-gatevoid	addlist(struct stringlist *, char *);
3607c478bdstevel@tonic-gatevoid	addarc(nltype *, nltype *, actype);
3617c478bdstevel@tonic-gateint	arccmp(arctype *, arctype *);
3627c478bdstevel@tonic-gatearctype	*arclookup(nltype *, nltype *);
3637c478bdstevel@tonic-gatevoid	printblurb(char *);
3647c478bdstevel@tonic-gatevoid	dfn(nltype *);
3657c478bdstevel@tonic-gatebool	dfn_busy(nltype *);
3667c478bdstevel@tonic-gatevoid	dfn_findcycle(nltype *);
3677c478bdstevel@tonic-gatebool	dfn_numbered(nltype *);
3687c478bdstevel@tonic-gatevoid	dfn_post_visit(nltype *);
3697c478bdstevel@tonic-gatevoid	dfn_pre_visit(nltype *);
3707c478bdstevel@tonic-gatevoid	dfn_self_cycle(nltype *);
3717c478bdstevel@tonic-gatenltype	**doarcs(void);
37292ed178mike_svoid	done(void);
3737c478bdstevel@tonic-gatevoid	findcalls(nltype *, pctype, pctype);
3747c478bdstevel@tonic-gatevoid	flatprofheader(void);
3757c478bdstevel@tonic-gatevoid	flatprofline(nltype *);
3767c478bdstevel@tonic-gatebool	is_shared_obj(char *);
3777c478bdstevel@tonic-gatevoid	getnfile(char *);
3787c478bdstevel@tonic-gatevoid	process_namelist(mod_info_t *);
3797c478bdstevel@tonic-gatevoid	gprofheader(void);
3807c478bdstevel@tonic-gatevoid	gprofline(nltype *);
38192ed178mike_sint	pc_cmp(const void *arg1, const void *arg2);
3827c478bdstevel@tonic-gateint	membercmp(nltype *, nltype *);
3837c478bdstevel@tonic-gatenltype	*nllookup(mod_info_t *, pctype, pctype *);
3847c478bdstevel@tonic-gatebool	onlist(struct stringlist *, char *);
3857c478bdstevel@tonic-gatevoid	printchildren(nltype *);
3867c478bdstevel@tonic-gatevoid	printcycle(nltype *);
3877c478bdstevel@tonic-gatevoid	printgprof(nltype **);
3887c478bdstevel@tonic-gatevoid	printindex(void);
3897c478bdstevel@tonic-gatevoid	printmembers(nltype *);
3907c478bdstevel@tonic-gatevoid	printmodules(void);
3917c478bdstevel@tonic-gatevoid	printname(nltype *);
3927c478bdstevel@tonic-gatevoid	printparents(nltype *);
3937c478bdstevel@tonic-gatevoid	printprof(void);
3947c478bdstevel@tonic-gatevoid	sortchildren(nltype *);
3957c478bdstevel@tonic-gatevoid	sortmembers(nltype *);
3967c478bdstevel@tonic-gatevoid	sortparents(nltype *);
39792ed178mike_sint	timecmp(const void *arg1, const void *arg2);
39892ed178mike_sint	totalcmp(const void *arg1, const void *arg2);
3997c478bdstevel@tonic-gate
4007c478bdstevel@tonic-gate#define	LESSTHAN	-1
4017c478bdstevel@tonic-gate#define	EQUALTO		0
4027c478bdstevel@tonic-gate#define	GREATERTHAN	1
4037c478bdstevel@tonic-gate
4047c478bdstevel@tonic-gate/*
4057c478bdstevel@tonic-gate * Macros related to debug messages.
4067c478bdstevel@tonic-gate */
4077c478bdstevel@tonic-gate#define	DFNDEBUG	0x0001
4087c478bdstevel@tonic-gate#define	CYCLEDEBUG	0x0002
4097c478bdstevel@tonic-gate#define	ARCDEBUG	0x0004
4107c478bdstevel@tonic-gate#define	TALLYDEBUG	0x0008
4117c478bdstevel@tonic-gate#define	TIMEDEBUG	0x0010
4127c478bdstevel@tonic-gate#define	SAMPLEDEBUG	0x0020
4137c478bdstevel@tonic-gate#define	ELFDEBUG	0x0040
4147c478bdstevel@tonic-gate#define	CALLSDEBUG	0x0080
4157c478bdstevel@tonic-gate#define	LOOKUPDEBUG	0x0100
4167c478bdstevel@tonic-gate#define	PROPDEBUG	0x0200
4177c478bdstevel@tonic-gate#define	ANYDEBUG	0x0400
4187c478bdstevel@tonic-gate
4197c478bdstevel@tonic-gate#define	MONOUTDEBUG	0x0800
4207c478bdstevel@tonic-gate#define	MODULEDEBUG	0x1000
4217c478bdstevel@tonic-gate#define	CGRAPHDEBUG	0x2000
4227c478bdstevel@tonic-gate#define	PCSMPLDEBUG	0x4000
4237c478bdstevel@tonic-gate
4247c478bdstevel@tonic-gate#ifdef	__cplusplus
4257c478bdstevel@tonic-gate}
4267c478bdstevel@tonic-gate#endif
4277c478bdstevel@tonic-gate
4287c478bdstevel@tonic-gate#endif	/* _SGS_GPROF_H */
429