-printprof()
-{
- register nltype *np;
- nltype **sortednlp;
- int index;
-
- actime = 0.0;
- putprofheader();
- /*
- * Sort the symbol table in by time
- */
- sortednlp = (nltype **) calloc( nname , sizeof(nltype *) );
- if ( sortednlp == (nltype **) 0 ) {
- fprintf( stderr , "[printprof] ran out of memory for time sorting\n" );
- }
- for ( index = 0 ; index < nname ; index += 1 ) {
- sortednlp[ index ] = &nl[ index ];
- }
- qsort( sortednlp , nname , sizeof(nltype *) , timecmp );
- for ( index = 0 ; index < nname ; index += 1 ) {
- np = sortednlp[ index ];
- putprofline( np , 1 );
- }
- actime = 0.0;
- printf( "\ngranularity: each sample hit covers %.1f bytes" , scale );
- printf( " for %.2f%% of %.2f seconds\n" , 100.0/totime , totime / HZ );
-}
-
-putprofline( np , cumflag )
- register nltype *np;
- int cumflag;
-{
- double time;
- long calls = np -> ncall + np -> selfcalls;
-
- if ( zflg == 0 && calls == 0 && np -> time == 0 && np -> childtime == 0 ) {
- return;
- }
- if ( cumflag ) {
- time = (np->time + np->childtime) / totime;
- actime += np->time;
- if ( np -> index != 0 ) {
- printf( "[%d]" , np -> index );
- }
- printf( "\t%5.1f %7.1f" , 100 * time , actime / HZ );
- } else {
- printf( "\t%5.5s %7.7s" , "" , "" );
- }
- printf( " %7.1f", np -> time / HZ );
- if ( np -> childtime != 0.0 ) {
- printf( " %7.1f" , np -> childtime / HZ );
- } else {
- printf( " %7.7s" , "" );
- }
- if ( calls != 0 ) {
- printf( " %7d" , np -> ncall );
- if ( np -> selfcalls != 0 ) {
- printf( "+%-7d " , np -> selfcalls );
- } else {
- printf( " %7.7s " , "" );
- }
- } else {
- printf( " %7.7s %7.7s " , "" , "" );
- }
- if ( ! cumflag ) {
- printf( " " );
- }
- printname( np );
- printf( "\n" );
-}
-