FreeBSD/usr.sbin/pmcstat/pmcpl_calltree.c
/*
 * Add a new instruction sample to given node.
 */
Add a new instruction sample to given node.
Add a new instruction sample to given node .
static void
pmcpl_ct_instr_add(struct pmcpl_ct_node *ct, int pmcin,
    uintfptr_t pc, unsigned v)
{
	int i;
	struct pmcpl_ct_instr *in;
	for (i = 0; i<ct->pct_ninstr; i++) {
		if (ct->pct_instr[i].pctf_func == pc) {
			in = &ct->pct_instr[i];
			pmcpl_ct_samples_grow(&in->pctf_samples);
			in->pctf_samples.sb[pmcin] += v;
			return;
		}
	}
	pmcpl_ct_instr_grow(ct->pct_ninstr, &ct->pct_instr_c, &ct->pct_instr);
	in = &ct->pct_instr[ct->pct_ninstr];
	in->pctf_func = pc;
	pmcpl_ct_samples_init(&in->pctf_samples);
	pmcpl_ct_samples_grow(&in->pctf_samples);
	in->pctf_samples.sb[pmcin] = v;
	ct->pct_ninstr++;
}
static void pmcpl_ct_instr_add ( struct pmcpl_ct_node * ct , int pmcin , uintfptr_t pc , unsigned v ) { int i ; struct pmcpl_ct_instr * in ; for ( i = 0 ; i < ct -> pct_ninstr ; i ++ ) { if ( ct -> pct_instr [ i ] . pctf_func == pc ) { in = & ct -> pct_instr [ i ] ; pmcpl_ct_samples_grow ( & in -> pctf_samples ) ; in -> pctf_samples . sb [ pmcin ] += v ; return ; } } pmcpl_ct_instr_grow ( ct -> pct_ninstr , & ct -> pct_instr_c , & ct -> pct_instr ) ; in = & ct -> pct_instr [ ct -> pct_ninstr ] ; in -> pctf_func = pc ; pmcpl_ct_samples_init ( & in -> pctf_samples ) ; pmcpl_ct_samples_grow ( & in -> pctf_samples ) ; in -> pctf_samples . sb [ pmcin ] = v ; ct -> pct_ninstr ++ ; }
Add a new instruction sample to given node.
Add a new instruction sample to given node .