rework old-style functions prototypes
reduce WARNS=6 output
This commit is contained in:
parent
f061b4d302
commit
8426ce9b0a
@ -68,7 +68,6 @@ int
|
|||||||
aout_getnfile(const char *filename, char ***defaultEs)
|
aout_getnfile(const char *filename, char ***defaultEs)
|
||||||
{
|
{
|
||||||
FILE *nfile;
|
FILE *nfile;
|
||||||
int valcmp();
|
|
||||||
|
|
||||||
nfile = fopen( filename ,"r");
|
nfile = fopen( filename ,"r");
|
||||||
if (nfile == NULL)
|
if (nfile == NULL)
|
||||||
|
@ -46,14 +46,13 @@ int newcycle;
|
|||||||
int oldcycle;
|
int oldcycle;
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
int topcmp(const void *, const void *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add (or just increment) an arc
|
* add (or just increment) an arc
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
addarc( parentp , childp , count )
|
addarc(nltype *parentp, nltype *childp, long count)
|
||||||
nltype *parentp;
|
|
||||||
nltype *childp;
|
|
||||||
long count;
|
|
||||||
{
|
{
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
|
|
||||||
@ -106,15 +105,16 @@ addarc( parentp , childp , count )
|
|||||||
nltype **topsortnlp;
|
nltype **topsortnlp;
|
||||||
|
|
||||||
int
|
int
|
||||||
topcmp( npp1 , npp2 )
|
topcmp(const void *v1, const void *v2)
|
||||||
nltype **npp1;
|
|
||||||
nltype **npp2;
|
|
||||||
{
|
{
|
||||||
|
const nltype **npp1 = (const nltype **)v1;
|
||||||
|
const nltype **npp2 = (const nltype **)v2;
|
||||||
|
|
||||||
return (*npp1) -> toporder - (*npp2) -> toporder;
|
return (*npp1) -> toporder - (*npp2) -> toporder;
|
||||||
}
|
}
|
||||||
|
|
||||||
nltype **
|
nltype **
|
||||||
doarcs()
|
doarcs(void)
|
||||||
{
|
{
|
||||||
nltype *parentp, **timesortnlp;
|
nltype *parentp, **timesortnlp;
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
@ -252,7 +252,7 @@ doarcs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dotime()
|
dotime(void)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
@ -263,8 +263,7 @@ dotime()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
timepropagate( parentp )
|
timepropagate(nltype *parentp)
|
||||||
nltype *parentp;
|
|
||||||
{
|
{
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
nltype *childp;
|
nltype *childp;
|
||||||
@ -352,7 +351,7 @@ timepropagate( parentp )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cyclelink()
|
cyclelink(void)
|
||||||
{
|
{
|
||||||
register nltype *nlp;
|
register nltype *nlp;
|
||||||
register nltype *cyclenlp;
|
register nltype *cyclenlp;
|
||||||
@ -445,7 +444,7 @@ cyclelink()
|
|||||||
* analyze cycles to determine breakup
|
* analyze cycles to determine breakup
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
cycleanalyze()
|
cycleanalyze(void)
|
||||||
{
|
{
|
||||||
arctype **cyclestack;
|
arctype **cyclestack;
|
||||||
arctype **stkp;
|
arctype **stkp;
|
||||||
@ -521,10 +520,7 @@ cycleanalyze()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
descend( node , stkstart , stkp )
|
descend(nltype *node, arctype **stkstart, arctype **stkp)
|
||||||
nltype *node;
|
|
||||||
arctype **stkstart;
|
|
||||||
arctype **stkp;
|
|
||||||
{
|
{
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
bool ret;
|
bool ret;
|
||||||
@ -556,9 +552,7 @@ descend( node , stkstart , stkp )
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
addcycle( stkstart , stkend )
|
addcycle(arctype **stkstart, arctype **stkend)
|
||||||
arctype **stkstart;
|
|
||||||
arctype **stkend;
|
|
||||||
{
|
{
|
||||||
arctype **arcpp;
|
arctype **arcpp;
|
||||||
arctype **stkloc;
|
arctype **stkloc;
|
||||||
@ -632,7 +626,7 @@ addcycle( stkstart , stkend )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
compresslist()
|
compresslist(void)
|
||||||
{
|
{
|
||||||
cltype *clp;
|
cltype *clp;
|
||||||
cltype **prev;
|
cltype **prev;
|
||||||
@ -748,8 +742,7 @@ compresslist()
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void
|
void
|
||||||
printsubcycle( clp )
|
printsubcycle(cltype *clp)
|
||||||
cltype *clp;
|
|
||||||
{
|
{
|
||||||
arctype **arcpp;
|
arctype **arcpp;
|
||||||
arctype **endlist;
|
arctype **endlist;
|
||||||
@ -764,7 +757,7 @@ printsubcycle( clp )
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
void
|
void
|
||||||
cycletime()
|
cycletime(void)
|
||||||
{
|
{
|
||||||
int cycle;
|
int cycle;
|
||||||
nltype *cyclenlp;
|
nltype *cyclenlp;
|
||||||
@ -794,7 +787,7 @@ cycletime()
|
|||||||
* and while we're here, sum time for functions.
|
* and while we're here, sum time for functions.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
doflags()
|
doflags(void)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
nltype *childp;
|
nltype *childp;
|
||||||
@ -889,8 +882,7 @@ doflags()
|
|||||||
* similarly, deal with propagation fractions from parents.
|
* similarly, deal with propagation fractions from parents.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
inheritflags( childp )
|
inheritflags(nltype *childp)
|
||||||
nltype *childp;
|
|
||||||
{
|
{
|
||||||
nltype *headp;
|
nltype *headp;
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
|
@ -52,7 +52,7 @@ int dfn_depth;
|
|||||||
int dfn_counter;
|
int dfn_counter;
|
||||||
|
|
||||||
void
|
void
|
||||||
dfn_init()
|
dfn_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
dfn_depth = 0;
|
dfn_depth = 0;
|
||||||
@ -63,8 +63,7 @@ dfn_init()
|
|||||||
* given this parent, depth first number its children.
|
* given this parent, depth first number its children.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dfn( parentp )
|
dfn(nltype *parentp)
|
||||||
nltype *parentp;
|
|
||||||
{
|
{
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
|
|
||||||
@ -110,8 +109,7 @@ dfn( parentp )
|
|||||||
* push a parent onto the stack and mark it busy
|
* push a parent onto the stack and mark it busy
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dfn_pre_visit( parentp )
|
dfn_pre_visit(nltype *parentp)
|
||||||
nltype *parentp;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
dfn_depth += 1;
|
dfn_depth += 1;
|
||||||
@ -133,8 +131,7 @@ dfn_pre_visit( parentp )
|
|||||||
* are we already numbered?
|
* are we already numbered?
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
dfn_numbered( childp )
|
dfn_numbered(nltype *childp)
|
||||||
nltype *childp;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return ( childp -> toporder != DFN_NAN && childp -> toporder != DFN_BUSY );
|
return ( childp -> toporder != DFN_NAN && childp -> toporder != DFN_BUSY );
|
||||||
@ -144,8 +141,7 @@ dfn_numbered( childp )
|
|||||||
* are we already busy?
|
* are we already busy?
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
dfn_busy( childp )
|
dfn_busy(nltype *childp)
|
||||||
nltype *childp;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( childp -> toporder == DFN_NAN ) {
|
if ( childp -> toporder == DFN_NAN ) {
|
||||||
@ -158,8 +154,7 @@ dfn_busy( childp )
|
|||||||
* MISSING: an explanation
|
* MISSING: an explanation
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dfn_findcycle( childp )
|
dfn_findcycle(nltype *childp)
|
||||||
nltype *childp;
|
|
||||||
{
|
{
|
||||||
int cycletop;
|
int cycletop;
|
||||||
nltype *cycleheadp;
|
nltype *cycleheadp;
|
||||||
@ -267,8 +262,7 @@ dfn_findcycle( childp )
|
|||||||
* for lint: ARGSUSED
|
* for lint: ARGSUSED
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dfn_self_cycle( parentp )
|
dfn_self_cycle(nltype *parentp)
|
||||||
nltype *parentp;
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* since we are taking out self-cycles elsewhere
|
* since we are taking out self-cycles elsewhere
|
||||||
@ -289,8 +283,7 @@ dfn_self_cycle( parentp )
|
|||||||
* and pop it off the stack
|
* and pop it off the stack
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dfn_post_visit( parentp )
|
dfn_post_visit(nltype *parentp)
|
||||||
nltype *parentp;
|
|
||||||
{
|
{
|
||||||
nltype *memberp;
|
nltype *memberp;
|
||||||
|
|
||||||
|
@ -51,15 +51,12 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
static int valcmp(const void *, const void *);
|
static int valcmp(const void *, const void *);
|
||||||
|
|
||||||
|
|
||||||
static struct gmonhdr gmonhdr;
|
static struct gmonhdr gmonhdr;
|
||||||
static int lflag;
|
static int lflag;
|
||||||
static int Lflag;
|
static int Lflag;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char **sp;
|
char **sp;
|
||||||
nltype **timesortnlp;
|
nltype **timesortnlp;
|
||||||
@ -233,11 +230,9 @@ main(argc, argv)
|
|||||||
* and the arcs.
|
* and the arcs.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
getpfile(filename)
|
getpfile(char *filename)
|
||||||
char *filename;
|
|
||||||
{
|
{
|
||||||
FILE *pfile;
|
FILE *pfile;
|
||||||
FILE *openpfile();
|
|
||||||
struct rawarc arc;
|
struct rawarc arc;
|
||||||
|
|
||||||
pfile = openpfile(filename);
|
pfile = openpfile(filename);
|
||||||
@ -262,8 +257,7 @@ getpfile(filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
openpfile(filename)
|
openpfile(char *filename)
|
||||||
char *filename;
|
|
||||||
{
|
{
|
||||||
struct gmonhdr tmp;
|
struct gmonhdr tmp;
|
||||||
FILE *pfile;
|
FILE *pfile;
|
||||||
@ -322,8 +316,7 @@ openpfile(filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tally( rawp )
|
tally(struct rawarc *rawp)
|
||||||
struct rawarc *rawp;
|
|
||||||
{
|
{
|
||||||
nltype *parentp;
|
nltype *parentp;
|
||||||
nltype *childp;
|
nltype *childp;
|
||||||
@ -351,8 +344,7 @@ tally( rawp )
|
|||||||
* dump out the gmon.sum file
|
* dump out the gmon.sum file
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dumpsum( sumfile )
|
dumpsum(const char *sumfile)
|
||||||
char *sumfile;
|
|
||||||
{
|
{
|
||||||
register nltype *nlp;
|
register nltype *nlp;
|
||||||
register arctype *arcp;
|
register arctype *arcp;
|
||||||
@ -393,9 +385,7 @@ dumpsum( sumfile )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
valcmp(v1, v2)
|
valcmp(const void *v1, const void *v2)
|
||||||
const void *v1;
|
|
||||||
const void *v2;
|
|
||||||
{
|
{
|
||||||
const nltype *p1 = (const nltype *)v1;
|
const nltype *p1 = (const nltype *)v1;
|
||||||
const nltype *p2 = (const nltype *)v2;
|
const nltype *p2 = (const nltype *)v2;
|
||||||
@ -410,8 +400,7 @@ valcmp(v1, v2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
readsamples(pfile)
|
readsamples(FILE *pfile)
|
||||||
FILE *pfile;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
intmax_t sample;
|
intmax_t sample;
|
||||||
@ -491,11 +480,11 @@ readsamples(pfile)
|
|||||||
* have any overlap (the two end cases, above).
|
* have any overlap (the two end cases, above).
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
asgnsamples()
|
asgnsamples(void)
|
||||||
{
|
{
|
||||||
register int j;
|
register int j;
|
||||||
double ccnt;
|
double ccnt;
|
||||||
double time;
|
double thetime;
|
||||||
unsigned long pcl, pch;
|
unsigned long pcl, pch;
|
||||||
register int i;
|
register int i;
|
||||||
unsigned long overlap;
|
unsigned long overlap;
|
||||||
@ -511,14 +500,14 @@ asgnsamples()
|
|||||||
continue;
|
continue;
|
||||||
pcl = lowpc + (unsigned long)(scale * i);
|
pcl = lowpc + (unsigned long)(scale * i);
|
||||||
pch = lowpc + (unsigned long)(scale * (i + 1));
|
pch = lowpc + (unsigned long)(scale * (i + 1));
|
||||||
time = ccnt;
|
thetime = ccnt;
|
||||||
# ifdef DEBUG
|
# ifdef DEBUG
|
||||||
if ( debug & SAMPLEDEBUG ) {
|
if ( debug & SAMPLEDEBUG ) {
|
||||||
printf( "[asgnsamples] pcl 0x%lx pch 0x%lx ccnt %.0f\n" ,
|
printf( "[asgnsamples] pcl 0x%lx pch 0x%lx ccnt %.0f\n" ,
|
||||||
pcl , pch , ccnt );
|
pcl , pch , ccnt );
|
||||||
}
|
}
|
||||||
# endif /* DEBUG */
|
# endif /* DEBUG */
|
||||||
totime += time;
|
totime += thetime;
|
||||||
for (j = j - 1; j < nname; j++) {
|
for (j = j - 1; j < nname; j++) {
|
||||||
svalue0 = nl[j].svalue;
|
svalue0 = nl[j].svalue;
|
||||||
svalue1 = nl[j+1].svalue;
|
svalue1 = nl[j+1].svalue;
|
||||||
@ -541,10 +530,10 @@ asgnsamples()
|
|||||||
printf("[asgnsamples] (0x%lx->0x%lx-0x%lx) %s gets %f ticks %lu overlap\n",
|
printf("[asgnsamples] (0x%lx->0x%lx-0x%lx) %s gets %f ticks %lu overlap\n",
|
||||||
nl[j].value / HISTORICAL_SCALE_2,
|
nl[j].value / HISTORICAL_SCALE_2,
|
||||||
svalue0, svalue1, nl[j].name,
|
svalue0, svalue1, nl[j].name,
|
||||||
overlap * time / scale, overlap);
|
overlap * thetime / scale, overlap);
|
||||||
}
|
}
|
||||||
# endif /* DEBUG */
|
# endif /* DEBUG */
|
||||||
nl[j].time += overlap * time / scale;
|
nl[j].time += overlap * thetime / scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,8 +546,7 @@ asgnsamples()
|
|||||||
|
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
min(a, b)
|
min(unsigned long a, unsigned long b)
|
||||||
unsigned long a,b;
|
|
||||||
{
|
{
|
||||||
if (a<b)
|
if (a<b)
|
||||||
return(a);
|
return(a);
|
||||||
@ -566,8 +554,7 @@ min(a, b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
max(a, b)
|
max(unsigned long a, unsigned long b)
|
||||||
unsigned long a,b;
|
|
||||||
{
|
{
|
||||||
if (a>b)
|
if (a>b)
|
||||||
return(a);
|
return(a);
|
||||||
@ -581,7 +568,7 @@ max(a, b)
|
|||||||
* for a routine is in the next bucket.
|
* for a routine is in the next bucket.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
alignentries()
|
alignentries(void)
|
||||||
{
|
{
|
||||||
register struct nl *nlp;
|
register struct nl *nlp;
|
||||||
unsigned long bucket_of_entry;
|
unsigned long bucket_of_entry;
|
||||||
|
@ -258,8 +258,8 @@ bool addcycle(arctype **, arctype **);
|
|||||||
void addlist(struct stringlist *, char *);
|
void addlist(struct stringlist *, char *);
|
||||||
void alignentries(void);
|
void alignentries(void);
|
||||||
int aout_getnfile(const char *, char ***);
|
int aout_getnfile(const char *, char ***);
|
||||||
int arccmp();
|
int arccmp(arctype *, arctype *);
|
||||||
arctype *arclookup();
|
arctype *arclookup(nltype *, nltype *);
|
||||||
void asgnsamples(void);
|
void asgnsamples(void);
|
||||||
void compresslist(void);
|
void compresslist(void);
|
||||||
bool cycleanalyze(void);
|
bool cycleanalyze(void);
|
||||||
@ -267,41 +267,36 @@ void cyclelink(void);
|
|||||||
void cycletime(void);
|
void cycletime(void);
|
||||||
bool descend(nltype *, arctype **, arctype **);
|
bool descend(nltype *, arctype **, arctype **);
|
||||||
void dfn(nltype *);
|
void dfn(nltype *);
|
||||||
bool dfn_busy();
|
bool dfn_busy(nltype *);
|
||||||
void dfn_findcycle(nltype *);
|
void dfn_findcycle(nltype *);
|
||||||
void dfn_init(void);
|
void dfn_init(void);
|
||||||
bool dfn_numbered();
|
bool dfn_numbered(nltype *);
|
||||||
void dfn_post_visit(nltype *);
|
void dfn_post_visit(nltype *);
|
||||||
void dfn_pre_visit(nltype *);
|
void dfn_pre_visit(nltype *);
|
||||||
void dfn_self_cycle(nltype *);
|
void dfn_self_cycle(nltype *);
|
||||||
nltype **doarcs();
|
nltype **doarcs(void);
|
||||||
void doflags(void);
|
void doflags(void);
|
||||||
void dotime(void);
|
void dotime(void);
|
||||||
void dumpsum(char *);
|
void dumpsum(const char *);
|
||||||
int elf_getnfile(const char *, char ***);
|
int elf_getnfile(const char *, char ***);
|
||||||
void flatprofheader(void);
|
void flatprofheader(void);
|
||||||
void flatprofline(nltype *);
|
void flatprofline(nltype *);
|
||||||
void getpfile(char *);
|
void getpfile(char *);
|
||||||
/*
|
void gprofheader(void);
|
||||||
gprofheader();
|
void gprofline(register nltype *);
|
||||||
gprofline();
|
|
||||||
*/
|
|
||||||
int hertz(void);
|
int hertz(void);
|
||||||
void inheritflags(nltype *);
|
void inheritflags(nltype *);
|
||||||
int kernel_getnfile(const char *, char ***);
|
int kernel_getnfile(const char *, char ***);
|
||||||
/*
|
/*
|
||||||
main();
|
main();
|
||||||
*/
|
*/
|
||||||
unsigned long max();
|
unsigned long max(unsigned long, unsigned long);
|
||||||
int membercmp();
|
int membercmp(nltype *, nltype *);
|
||||||
unsigned long min();
|
unsigned long min(unsigned long, unsigned long);
|
||||||
nltype *nllookup();
|
nltype *nllookup(unsigned long);
|
||||||
bool onlist(struct stringlist *, const char *);
|
bool onlist(struct stringlist *, const char *);
|
||||||
FILE *openpfile();
|
FILE *openpfile(char *);
|
||||||
long operandlength();
|
void printblurb(const char *);
|
||||||
operandenum operandmode();
|
|
||||||
char *operandname();
|
|
||||||
void printblurb(char *);
|
|
||||||
void printchildren(nltype *);
|
void printchildren(nltype *);
|
||||||
void printcycle(nltype *);
|
void printcycle(nltype *);
|
||||||
void printgprof(nltype **);
|
void printgprof(nltype **);
|
||||||
@ -312,13 +307,12 @@ void printparents(nltype *);
|
|||||||
void printprof(void);
|
void printprof(void);
|
||||||
void printsubcycle(cltype *);
|
void printsubcycle(cltype *);
|
||||||
void readsamples(FILE *);
|
void readsamples(FILE *);
|
||||||
unsigned long reladdr();
|
|
||||||
void sortchildren(nltype *);
|
void sortchildren(nltype *);
|
||||||
void sortmembers(nltype *);
|
void sortmembers(nltype *);
|
||||||
void sortparents(nltype *);
|
void sortparents(nltype *);
|
||||||
void tally(struct rawarc *);
|
void tally(struct rawarc *);
|
||||||
void timepropagate(nltype *);
|
void timepropagate(nltype *);
|
||||||
int totalcmp();
|
int totalcmp(const void *, const void *);
|
||||||
|
|
||||||
#define LESSTHAN -1
|
#define LESSTHAN -1
|
||||||
#define EQUALTO 0
|
#define EQUALTO 0
|
||||||
|
@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
*/
|
*/
|
||||||
#define HZ_WRONG 0
|
#define HZ_WRONG 0
|
||||||
|
|
||||||
|
int hertz(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
hertz(void)
|
hertz(void)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
static char *excludes[] = { ".mcount", "_mcleanup", NULL };
|
static char *excludes[] = { ".mcount", "_mcleanup", NULL };
|
||||||
|
|
||||||
int
|
int
|
||||||
kernel_getnfile(const char *unused, char ***defaultEs)
|
kernel_getnfile(const char *unused __unused, char ***defaultEs)
|
||||||
{
|
{
|
||||||
char *namelist;
|
char *namelist;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -44,8 +44,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* entry point.
|
* entry point.
|
||||||
*/
|
*/
|
||||||
nltype *
|
nltype *
|
||||||
nllookup( address )
|
nllookup(unsigned long address)
|
||||||
unsigned long address;
|
|
||||||
{
|
{
|
||||||
register long low;
|
register long low;
|
||||||
register long middle;
|
register long middle;
|
||||||
@ -90,9 +89,7 @@ nllookup( address )
|
|||||||
}
|
}
|
||||||
|
|
||||||
arctype *
|
arctype *
|
||||||
arclookup( parentp , childp )
|
arclookup(nltype *parentp, nltype *childp)
|
||||||
nltype *parentp;
|
|
||||||
nltype *childp;
|
|
||||||
{
|
{
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
|
|
||||||
|
@ -42,12 +42,15 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "gprof.h"
|
#include "gprof.h"
|
||||||
#include "pathnames.h"
|
#include "pathnames.h"
|
||||||
|
|
||||||
|
int namecmp(const void *, const void *);
|
||||||
|
int timecmp(const void *, const void *);
|
||||||
|
|
||||||
void
|
void
|
||||||
printprof()
|
printprof(void)
|
||||||
{
|
{
|
||||||
register nltype *np;
|
register nltype *np;
|
||||||
nltype **sortednlp;
|
nltype **sortednlp;
|
||||||
int index, timecmp();
|
int idx;
|
||||||
|
|
||||||
actime = 0.0;
|
actime = 0.0;
|
||||||
printf( "\f\n" );
|
printf( "\f\n" );
|
||||||
@ -58,12 +61,12 @@ printprof()
|
|||||||
sortednlp = (nltype **) calloc( nname , sizeof(nltype *) );
|
sortednlp = (nltype **) calloc( nname , sizeof(nltype *) );
|
||||||
if ( sortednlp == (nltype **) 0 )
|
if ( sortednlp == (nltype **) 0 )
|
||||||
errx( 1 , "[printprof] ran out of memory for time sorting" );
|
errx( 1 , "[printprof] ran out of memory for time sorting" );
|
||||||
for ( index = 0 ; index < nname ; index += 1 ) {
|
for ( idx = 0 ; idx < nname ; idx += 1 ) {
|
||||||
sortednlp[ index ] = &nl[ index ];
|
sortednlp[ idx ] = &nl[ idx ];
|
||||||
}
|
}
|
||||||
qsort( sortednlp , nname , sizeof(nltype *) , timecmp );
|
qsort( sortednlp , nname , sizeof(nltype *) , timecmp );
|
||||||
for ( index = 0 ; index < nname ; index += 1 ) {
|
for ( idx = 0 ; idx < nname ; idx += 1 ) {
|
||||||
np = sortednlp[ index ];
|
np = sortednlp[ idx ];
|
||||||
flatprofline( np );
|
flatprofline( np );
|
||||||
}
|
}
|
||||||
actime = 0.0;
|
actime = 0.0;
|
||||||
@ -71,9 +74,10 @@ printprof()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
timecmp( npp1 , npp2 )
|
timecmp(const void *v1, const void *v2)
|
||||||
nltype **npp1, **npp2;
|
|
||||||
{
|
{
|
||||||
|
const nltype **npp1 = (const nltype **)v1;
|
||||||
|
const nltype **npp2 = (const nltype **)v2;
|
||||||
double timediff;
|
double timediff;
|
||||||
long calldiff;
|
long calldiff;
|
||||||
|
|
||||||
@ -94,7 +98,7 @@ timecmp( npp1 , npp2 )
|
|||||||
* header for flatprofline
|
* header for flatprofline
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
flatprofheader()
|
flatprofheader(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( bflag ) {
|
if ( bflag ) {
|
||||||
@ -122,8 +126,7 @@ flatprofheader()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
flatprofline( np )
|
flatprofline(register nltype *np)
|
||||||
register nltype *np;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( zflag == 0 && np -> ncall == 0 && np -> time == 0 &&
|
if ( zflag == 0 && np -> ncall == 0 && np -> time == 0 &&
|
||||||
@ -161,7 +164,7 @@ flatprofline( np )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gprofheader()
|
gprofheader(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( bflag ) {
|
if ( bflag ) {
|
||||||
@ -190,8 +193,7 @@ gprofheader()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gprofline( np )
|
gprofline(register nltype *np)
|
||||||
register nltype *np;
|
|
||||||
{
|
{
|
||||||
char kirkbuffer[ BUFSIZ ];
|
char kirkbuffer[ BUFSIZ ];
|
||||||
|
|
||||||
@ -216,18 +218,17 @@ gprofline( np )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
printgprof(timesortnlp)
|
printgprof(nltype **timesortnlp)
|
||||||
nltype **timesortnlp;
|
|
||||||
{
|
{
|
||||||
int index;
|
int idx;
|
||||||
nltype *parentp;
|
nltype *parentp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print out the structured profiling list
|
* Print out the structured profiling list
|
||||||
*/
|
*/
|
||||||
gprofheader();
|
gprofheader();
|
||||||
for ( index = 0 ; index < nname + ncycle ; index ++ ) {
|
for ( idx = 0 ; idx < nname + ncycle ; idx ++ ) {
|
||||||
parentp = timesortnlp[ index ];
|
parentp = timesortnlp[ idx ];
|
||||||
if ( zflag == 0 &&
|
if ( zflag == 0 &&
|
||||||
parentp -> ncall == 0 &&
|
parentp -> ncall == 0 &&
|
||||||
parentp -> selfcalls == 0 &&
|
parentp -> selfcalls == 0 &&
|
||||||
@ -265,12 +266,12 @@ printgprof(timesortnlp)
|
|||||||
* all else being equal, sort by names.
|
* all else being equal, sort by names.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
totalcmp( npp1 , npp2 )
|
totalcmp(const void *v1, const void *v2)
|
||||||
nltype **npp1;
|
|
||||||
nltype **npp2;
|
|
||||||
{
|
{
|
||||||
register nltype *np1 = *npp1;
|
const nltype **npp1 = (const nltype **)v1;
|
||||||
register nltype *np2 = *npp2;
|
const nltype **npp2 = (const nltype **)v2;
|
||||||
|
register const nltype *np1 = *npp1;
|
||||||
|
register const nltype *np2 = *npp2;
|
||||||
double diff;
|
double diff;
|
||||||
|
|
||||||
diff = ( np1 -> propself + np1 -> propchild )
|
diff = ( np1 -> propself + np1 -> propchild )
|
||||||
@ -299,8 +300,7 @@ totalcmp( npp1 , npp2 )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
printparents( childp )
|
printparents(nltype *childp)
|
||||||
nltype *childp;
|
|
||||||
{
|
{
|
||||||
nltype *parentp;
|
nltype *parentp;
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
@ -344,8 +344,7 @@ printparents( childp )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
printchildren( parentp )
|
printchildren(nltype *parentp)
|
||||||
nltype *parentp;
|
|
||||||
{
|
{
|
||||||
nltype *childp;
|
nltype *childp;
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
@ -378,8 +377,7 @@ printchildren( parentp )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
printname( selfp )
|
printname(nltype *selfp)
|
||||||
nltype *selfp;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( selfp -> name != 0 ) {
|
if ( selfp -> name != 0 ) {
|
||||||
@ -406,8 +404,7 @@ printname( selfp )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sortchildren( parentp )
|
sortchildren(nltype *parentp)
|
||||||
nltype *parentp;
|
|
||||||
{
|
{
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
arctype *detachedp;
|
arctype *detachedp;
|
||||||
@ -447,8 +444,7 @@ sortchildren( parentp )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sortparents( childp )
|
sortparents(nltype *childp)
|
||||||
nltype *childp;
|
|
||||||
{
|
{
|
||||||
arctype *arcp;
|
arctype *arcp;
|
||||||
arctype *detachedp;
|
arctype *detachedp;
|
||||||
@ -491,8 +487,7 @@ sortparents( childp )
|
|||||||
* print a cycle header
|
* print a cycle header
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
printcycle( cyclep )
|
printcycle(nltype *cyclep)
|
||||||
nltype *cyclep;
|
|
||||||
{
|
{
|
||||||
char kirkbuffer[ BUFSIZ ];
|
char kirkbuffer[ BUFSIZ ];
|
||||||
|
|
||||||
@ -516,8 +511,7 @@ printcycle( cyclep )
|
|||||||
* print the members of a cycle
|
* print the members of a cycle
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
printmembers( cyclep )
|
printmembers(nltype *cyclep)
|
||||||
nltype *cyclep;
|
|
||||||
{
|
{
|
||||||
nltype *memberp;
|
nltype *memberp;
|
||||||
|
|
||||||
@ -541,8 +535,7 @@ printmembers( cyclep )
|
|||||||
* sort members of a cycle
|
* sort members of a cycle
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sortmembers( cyclep )
|
sortmembers(nltype *cyclep)
|
||||||
nltype *cyclep;
|
|
||||||
{
|
{
|
||||||
nltype *todo;
|
nltype *todo;
|
||||||
nltype *doing;
|
nltype *doing;
|
||||||
@ -572,9 +565,7 @@ sortmembers( cyclep )
|
|||||||
* next is sort on ncalls + selfcalls.
|
* next is sort on ncalls + selfcalls.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
membercmp( this , that )
|
membercmp(nltype *this, nltype *that)
|
||||||
nltype *this;
|
|
||||||
nltype *that;
|
|
||||||
{
|
{
|
||||||
double thistime = this -> propself + this -> propchild;
|
double thistime = this -> propself + this -> propchild;
|
||||||
double thattime = that -> propself + that -> propchild;
|
double thattime = that -> propself + that -> propchild;
|
||||||
@ -605,9 +596,7 @@ membercmp( this , that )
|
|||||||
* arc count as minor key
|
* arc count as minor key
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
arccmp( thisp , thatp )
|
arccmp(arctype *thisp, arctype *thatp)
|
||||||
arctype *thisp;
|
|
||||||
arctype *thatp;
|
|
||||||
{
|
{
|
||||||
nltype *thisparentp = thisp -> arc_parentp;
|
nltype *thisparentp = thisp -> arc_parentp;
|
||||||
nltype *thischildp = thisp -> arc_childp;
|
nltype *thischildp = thisp -> arc_childp;
|
||||||
@ -684,8 +673,7 @@ arccmp( thisp , thatp )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
printblurb( blurbname )
|
printblurb(const char *blurbname)
|
||||||
char *blurbname;
|
|
||||||
{
|
{
|
||||||
FILE *blurbfile;
|
FILE *blurbfile;
|
||||||
int input;
|
int input;
|
||||||
@ -702,18 +690,20 @@ printblurb( blurbname )
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
namecmp( npp1 , npp2 )
|
namecmp(const void *v1, const void *v2)
|
||||||
nltype **npp1, **npp2;
|
|
||||||
{
|
{
|
||||||
|
const nltype **npp1 = (const nltype **)v1;
|
||||||
|
const nltype **npp2 = (const nltype **)v2;
|
||||||
|
|
||||||
return( strcmp( (*npp1) -> name , (*npp2) -> name ) );
|
return( strcmp( (*npp1) -> name , (*npp2) -> name ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
printindex()
|
printindex(void)
|
||||||
{
|
{
|
||||||
nltype **namesortnlp;
|
nltype **namesortnlp;
|
||||||
register nltype *nlp;
|
register nltype *nlp;
|
||||||
int index, nnames, todo, i, j;
|
int idx, nnames, todo, i, j;
|
||||||
char peterbuffer[ BUFSIZ ];
|
char peterbuffer[ BUFSIZ ];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -723,19 +713,19 @@ printindex()
|
|||||||
namesortnlp = (nltype **) calloc( nname + ncycle , sizeof(nltype *) );
|
namesortnlp = (nltype **) calloc( nname + ncycle , sizeof(nltype *) );
|
||||||
if ( namesortnlp == (nltype **) 0 )
|
if ( namesortnlp == (nltype **) 0 )
|
||||||
errx( 1 , "ran out of memory for sorting");
|
errx( 1 , "ran out of memory for sorting");
|
||||||
for ( index = 0 , nnames = 0 ; index < nname ; index++ ) {
|
for ( idx = 0 , nnames = 0 ; idx < nname ; idx++ ) {
|
||||||
if ( zflag == 0 && nl[index].ncall == 0 && nl[index].time == 0 )
|
if ( zflag == 0 && nl[idx].ncall == 0 && nl[idx].time == 0 )
|
||||||
continue;
|
continue;
|
||||||
namesortnlp[nnames++] = &nl[index];
|
namesortnlp[nnames++] = &nl[idx];
|
||||||
}
|
}
|
||||||
qsort( namesortnlp , nnames , sizeof(nltype *) , namecmp );
|
qsort( namesortnlp , nnames , sizeof(nltype *) , namecmp );
|
||||||
for ( index = 1 , todo = nnames ; index <= ncycle ; index++ ) {
|
for ( idx = 1 , todo = nnames ; idx <= ncycle ; idx++ ) {
|
||||||
namesortnlp[todo++] = &cyclenl[index];
|
namesortnlp[todo++] = &cyclenl[idx];
|
||||||
}
|
}
|
||||||
printf( "\f\nIndex by function name\n\n" );
|
printf( "\f\nIndex by function name\n\n" );
|
||||||
index = ( todo + 2 ) / 3;
|
idx = ( todo + 2 ) / 3;
|
||||||
for ( i = 0; i < index ; i++ ) {
|
for ( i = 0; i < idx ; i++ ) {
|
||||||
for ( j = i; j < todo ; j += index ) {
|
for ( j = i; j < todo ; j += idx ) {
|
||||||
nlp = namesortnlp[ j ];
|
nlp = namesortnlp[ j ];
|
||||||
if ( nlp -> printflag ) {
|
if ( nlp -> printflag ) {
|
||||||
sprintf( peterbuffer , "[%d]" , nlp -> index );
|
sprintf( peterbuffer , "[%d]" , nlp -> index );
|
||||||
|
@ -61,9 +61,7 @@ struct stringlist Ehead = { 0 , 0 };
|
|||||||
struct stringlist *Elist = &Ehead;
|
struct stringlist *Elist = &Ehead;
|
||||||
|
|
||||||
void
|
void
|
||||||
addlist( listp , funcname )
|
addlist(struct stringlist *listp, char *funcname)
|
||||||
struct stringlist *listp;
|
|
||||||
char *funcname;
|
|
||||||
{
|
{
|
||||||
struct stringlist *slp;
|
struct stringlist *slp;
|
||||||
|
|
||||||
@ -76,9 +74,7 @@ addlist( listp , funcname )
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
onlist( listp , funcname )
|
onlist(struct stringlist *listp, const char *funcname)
|
||||||
struct stringlist *listp;
|
|
||||||
const char *funcname;
|
|
||||||
{
|
{
|
||||||
struct stringlist *slp;
|
struct stringlist *slp;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user