projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
account for entry mask
[unix-history]
/
usr
/
src
/
usr.bin
/
gprof
/
arcs.c
diff --git
a/usr/src/usr.bin/gprof/arcs.c
b/usr/src/usr.bin/gprof/arcs.c
index
d7b745a
..
dd3118d
100644
(file)
--- a/
usr/src/usr.bin/gprof/arcs.c
+++ b/
usr/src/usr.bin/gprof/arcs.c
@@
-1,5
+1,5
@@
#ifndef lint
#ifndef lint
- static char *sccsid = "@(#)arcs.c 1.
9
(Berkeley) %G%";
+ static char *sccsid = "@(#)arcs.c 1.
13
(Berkeley) %G%";
#endif lint
#include "gprof.h"
#endif lint
#include "gprof.h"
@@
-93,7
+93,7
@@
doarcs()
parentp -> propself = 0.0;
parentp -> propchild = 0.0;
parentp -> printflag = FALSE;
parentp -> propself = 0.0;
parentp -> propchild = 0.0;
parentp -> printflag = FALSE;
- parentp -> toporder =
0
;
+ parentp -> toporder =
DFN_NAN
;
parentp -> cycleno = 0;
parentp -> cyclehead = parentp;
parentp -> cnext = 0;
parentp -> cycleno = 0;
parentp -> cyclehead = parentp;
parentp -> cnext = 0;
@@
-103,10
+103,11
@@
doarcs()
}
/*
* topologically order things
}
/*
* topologically order things
- * from each of the roots of the call graph
+ * if any node is unnumbered,
+ * number it and any of its descendents.
*/
for ( parentp = nl ; parentp < npe ; parentp++ ) {
*/
for ( parentp = nl ; parentp < npe ; parentp++ ) {
- if ( parentp ->
parents == 0
) {
+ if ( parentp ->
toporder == DFN_NAN
) {
dfn( parentp );
}
}
dfn( parentp );
}
}
@@
-283,12
+284,12
@@
cyclelink()
*/
cycle = 0;
for ( nlp = nl ; nlp < npe ; nlp++ ) {
*/
cycle = 0;
for ( nlp = nl ; nlp < npe ; nlp++ ) {
- if (
nlp -> cyclehead != nlp || nlp -> cnext == 0
) {
+ if (
!( nlp -> cyclehead == nlp && nlp -> cnext != 0 )
) {
continue;
}
cycle += 1;
cyclenlp = &cyclenl[cycle];
continue;
}
cycle += 1;
cyclenlp = &cyclenl[cycle];
- cyclenlp -> name =
"";
/* the name */
+ cyclenlp -> name =
0;
/* the name */
cyclenlp -> value = 0; /* the pc entry point */
cyclenlp -> time = 0.0; /* ticks in this routine */
cyclenlp -> childtime = 0.0; /* cumulative ticks in children */
cyclenlp -> value = 0; /* the pc entry point */
cyclenlp -> time = 0.0; /* ticks in this routine */
cyclenlp -> childtime = 0.0; /* cumulative ticks in children */
@@
-299,7
+300,7
@@
cyclelink()
cyclenlp -> propchild = 0.0; /* how much child time propagates */
cyclenlp -> printflag = TRUE; /* should this be printed? */
cyclenlp -> index = 0; /* index in the graph list */
cyclenlp -> propchild = 0.0; /* how much child time propagates */
cyclenlp -> printflag = TRUE; /* should this be printed? */
cyclenlp -> index = 0; /* index in the graph list */
- cyclenlp -> toporder =
0;
/* graph call chain top-sort order */
+ cyclenlp -> toporder =
DFN_NAN;
/* graph call chain top-sort order */
cyclenlp -> cycleno = cycle; /* internal number of cycle on */
cyclenlp -> cyclehead = cyclenlp; /* pointer to head of cycle */
cyclenlp -> cnext = nlp; /* pointer to next member of cycle */
cyclenlp -> cycleno = cycle; /* internal number of cycle on */
cyclenlp -> cyclehead = cyclenlp; /* pointer to head of cycle */
cyclenlp -> cnext = nlp; /* pointer to next member of cycle */
@@
-343,8
+344,6
@@
cycletime()
int cycle;
nltype *cyclenlp;
nltype *childp;
int cycle;
nltype *cyclenlp;
nltype *childp;
- arctype *arcp;
- nltype *parentp;
for ( cycle = 1 ; cycle <= ncycle ; cycle += 1 ) {
cyclenlp = &cyclenl[ cycle ];
for ( cycle = 1 ; cycle <= ncycle ; cycle += 1 ) {
cyclenlp = &cyclenl[ cycle ];
@@
-449,8
+448,8
@@
doflags()
printname( childp );
printf( " ends up with printflag %d and propfraction %f\n" ,
childp -> printflag , childp -> propfraction );
printname( childp );
printf( " ends up with printflag %d and propfraction %f\n" ,
childp -> printflag , childp -> propfraction );
- printf( "time %f propself %f\n" ,
- childp -> time , childp -> propself );
+ printf( "time %f propself %f
printtime %f
\n" ,
+ childp -> time , childp -> propself
, printtime
);
}
# endif DEBUG
}
}
# endif DEBUG
}
@@
-480,6
+479,9
@@
inheritflags( childp )
childp -> propfraction = 0.0;
for (arcp = childp -> parents ; arcp ; arcp = arcp -> arc_parentlist) {
parentp = arcp -> arc_parentp;
childp -> propfraction = 0.0;
for (arcp = childp -> parents ; arcp ; arcp = arcp -> arc_parentlist) {
parentp = arcp -> arc_parentp;
+ if ( childp == parentp ) {
+ continue;
+ }
childp -> printflag |= parentp -> printflag;
childp -> propfraction += parentp -> propfraction
* ( ( (double) arcp -> arc_count )
childp -> printflag |= parentp -> printflag;
childp -> propfraction += parentp -> propfraction
* ( ( (double) arcp -> arc_count )