FreeBSD/usr.sbin/pmcannotate/pmcannotate.c
/*
 * Analyze the "objdump -d" output, locate functions and start
 * printing out the assembly functions content.
 * We do not use newfunction() because we actually need the
 * function name in available form, but the heurstic used is
 * the same.
 */
Analyze the "objdump -d" output, locate functions and start
printing out the assembly functions content.
We do not use newfunction() because we actually need the
function name in available form, but the heurstic used is
the same.
Analyze the " objdump - d " output locate functions and start printing out the assembly functions content . We do not use newfunction () because we actually need the function name in available form but the heurstic used is the same .
static void
asmparse(FILE *fp)
{
	char buffer[LNBUFF], fname[FNBUFF];
	struct aggent *agg;
	void *ptr;
	while (fgets(buffer, LNBUFF, fp) != NULL) {
		if (isspace(buffer[0]))
			continue;
		if (sscanf(buffer, "%p <%[^>:]>:", &ptr, fname) != 2)
			continue;
		agg = fqueue_findent_by_name(fname);
		if (agg == NULL)
			continue;
		agg->ag_offset = ftell(fp);
	}
	TAILQ_FOREACH(agg, &fqueue, ag_fiter) {
		if (fseek(fp, agg->ag_offset, SEEK_SET) == -1)
			return;
		printf("Profile trace for function: %s() [%.2f%%]\n",
		    agg->ag_name, PERCSAMP(agg->ag_nsamples));
		general_printasm(fp, agg);
		printf("\n");
	}
}
static void asmparse ( FILE * fp ) { char buffer [ LNBUFF ] , fname [ FNBUFF ] ; struct aggent * agg ; void * ptr ; while ( fgets ( buffer , LNBUFF , fp ) != NULL ) { if ( isspace ( buffer [ 0 ] ) ) continue ; if ( sscanf ( buffer , " " , & ptr , fname ) != 2 ) continue ; agg = fqueue_findent_by_name ( fname ) ; if ( agg == NULL ) continue ; agg -> ag_offset = ftell ( fp ) ; } TAILQ_FOREACH ( agg , & fqueue , ag_fiter ) { if ( fseek ( fp , agg -> ag_offset , SEEK_SET ) == -1 ) return ; printf ( " \n " , agg -> ag_name , PERCSAMP ( agg -> ag_nsamples ) ) ; general_printasm ( fp , agg ) ; printf ( " \n " ) ; } }
Analyze the "objdump -d" output, locate functions and start
 printing out the assembly functions content.
Analyze the " objdump - d " output locate functions and start printing out the assembly functions content .