/** Get difference perfcnt cycles between event idx and event idx+1. * @param idx position of first event in tracebuffer * @param nr number of perfcounter (0=first, 1=second) * @retval difference in perfcnt cycles * @return 0 if something wrong, 1 if everything ok */ PUBLIC static int Jdb_tbuf::diff_pmc(Mword idx, Mword nr, Signed32 *delta) { Tb_entry *e = lookup(idx); Tb_entry *e_prev = lookup(idx + 1); if (!e || !e_prev) return false; switch (nr) { case 0: *delta = e->pmc1() - e_prev->pmc1(); break; case 1: *delta = e->pmc2() - e_prev->pmc2(); break; } return true; }
/** Return some information about log event. * @param idx number of event to determine the info * @retval number event number * @retval tsc event value of CPU cycles * @retval pmc event value of perf counter cycles * @return 0 if something wrong, 1 if everything ok */ PUBLIC static int Jdb_tbuf::event(Mword idx, Mword *number, Unsigned32 *kclock, Unsigned64 *tsc, Unsigned32 *pmc1, Unsigned32 *pmc2) { Tb_entry *e = lookup(idx); if (!e) return false; *number = e->number(); if (kclock) *kclock = e->kclock(); if (tsc) *tsc = e->tsc(); if (pmc1) *pmc1 = e->pmc1(); if (pmc2) *pmc2 = e->pmc2(); return true; }