FreeBSD/usr.sbin/pmcstat/pmcpl_calltree.c
/*
 * Look for a callgraph node associated with pmc `pmcid' in the global
 * hash table that corresponds to the given `pc' value in the process map
 * `ppm'.
 */
Look for a callgraph node associated with pmc `pmcid' in the global
hash table that corresponds to the given `pc' value in the process map
`ppm'.
Look for a callgraph node associated with pmc ` pmcid ' in the global hash table that corresponds to the given ` pc ' value in the process map ` ppm ' .
static void
pmcpl_ct_node_update(struct pmcpl_ct_node *parent,
    struct pmcpl_ct_node *child, int pmcin, unsigned v, int cd)
{
	struct pmcpl_ct_arc *arc;
	int i;
	assert(parent != NULL);
	for (i = 0; i < parent->pct_narc; i++) {
		if (parent->pct_arc[i].pcta_child == child) {
			arc = &parent->pct_arc[i];
			pmcpl_ct_samples_grow(&arc->pcta_samples);
			arc->pcta_samples.sb[pmcin] += v;
			if (cd) {
			pmcpl_ct_samples_grow(&arc->pcta_callid);
			if (pmcpl_ct_callid.sb[pmcin] -
			    arc->pcta_callid.sb[pmcin] > 1)
				arc->pcta_call++;
			arc->pcta_callid.sb[pmcin] =
			    pmcpl_ct_callid.sb[pmcin];
			}
			return;
		}
	}
	pmcpl_ct_arc_grow(parent->pct_narc,
	    &parent->pct_arc_c, &parent->pct_arc);
	arc = &parent->pct_arc[parent->pct_narc];
	pmcpl_ct_samples_grow(&arc->pcta_samples);
	arc->pcta_samples.sb[pmcin] = v;
	arc->pcta_call = 1;
	if (cd) {
		pmcpl_ct_samples_grow(&arc->pcta_callid);
		arc->pcta_callid.sb[pmcin] = pmcpl_ct_callid.sb[pmcin];
	}
	arc->pcta_child = child;
	parent->pct_narc++;
}
static void pmcpl_ct_node_update ( struct pmcpl_ct_node * parent , struct pmcpl_ct_node * child , int pmcin , unsigned v , int cd ) { struct pmcpl_ct_arc * arc ; int i ; assert ( parent != NULL ) ; for ( i = 0 ; i < parent -> pct_narc ; i ++ ) { if ( parent -> pct_arc [ i ] . pcta_child == child ) { arc = & parent -> pct_arc [ i ] ; pmcpl_ct_samples_grow ( & arc -> pcta_samples ) ; arc -> pcta_samples . sb [ pmcin ] += v ; if ( cd ) { pmcpl_ct_samples_grow ( & arc -> pcta_callid ) ; if ( pmcpl_ct_callid . sb [ pmcin ] - arc -> pcta_callid . sb [ pmcin ] > 1 ) arc -> pcta_call ++ ; arc -> pcta_callid . sb [ pmcin ] = pmcpl_ct_callid . sb [ pmcin ] ; } return ; } } pmcpl_ct_arc_grow ( parent -> pct_narc , & parent -> pct_arc_c , & parent -> pct_arc ) ; arc = & parent -> pct_arc [ parent -> pct_narc ] ; pmcpl_ct_samples_grow ( & arc -> pcta_samples ) ; arc -> pcta_samples . sb [ pmcin ] = v ; arc -> pcta_call = 1 ; if ( cd ) { pmcpl_ct_samples_grow ( & arc -> pcta_callid ) ; arc -> pcta_callid . sb [ pmcin ] = pmcpl_ct_callid . sb [ pmcin ] ; } arc -> pcta_child = child ; parent -> pct_narc ++ ; }
Look for a callgraph node associated with pmc `pmcid' in the global
 hash table that corresponds to the given `pc' value in the process map
 `ppm'.
Look for a callgraph node associated with pmc ` pmcid ' in the global hash table that corresponds to the given ` pc ' value in the process map ` ppm ' .
/*
	 * Find related arc in parent node and
	 * increment the sample count.
	 */ /* Estimate call count. */ /*
	 * No arc found for us, add ourself to the parent.
	 */