FreeBSD/usr.sbin/pmcstat/pmcpl_callgraph.c
/*
 * Find (allocating if a needed) a callgraph node in the given
 * parent with the same (image, pcoffset) pair.
 */
Find (allocating if a needed) a callgraph node in the given
parent with the same (image, pcoffset) pair.
Find ( allocating if a needed ) a callgraph node in the given parent with the same ( image pcoffset ) pair .
static struct pmcstat_cgnode *
pmcstat_cgnode_find(struct pmcstat_cgnode *parent, struct pmcstat_image *image,
    uintfptr_t pcoffset)
{
	struct pmcstat_cgnode *child;
	LIST_FOREACH(child, &parent->pcg_children, pcg_sibling) {
		if (child->pcg_image == image &&
		    child->pcg_func == pcoffset)
			return (child);
	}
	child = pmcstat_cgnode_allocate(image, pcoffset);
	LIST_INSERT_HEAD(&parent->pcg_children, child, pcg_sibling);
	parent->pcg_nchildren++;
	return (child);
}
static struct pmcstat_cgnode * pmcstat_cgnode_find ( struct pmcstat_cgnode * parent , struct pmcstat_image * image , uintfptr_t pcoffset ) { struct pmcstat_cgnode * child ; LIST_FOREACH ( child , & parent -> pcg_children , pcg_sibling ) { if ( child -> pcg_image == image && child -> pcg_func == pcoffset ) return ( child ) ; } child = pmcstat_cgnode_allocate ( image , pcoffset ) ; LIST_INSERT_HEAD ( & parent -> pcg_children , child , pcg_sibling ) ; parent -> pcg_nchildren ++ ; return ( child ) ; }
Find (allocating if a needed) a callgraph node in the given
 parent with the same (image, pcoffset) pair.
Find ( allocating if a needed ) a callgraph node in the given parent with the same ( image pcoffset ) pair .
/*
	 * Allocate a new structure.
	 */ /*
	 * Link it into the parent.
	 */