/** Get difference CPU cycles between event idx and event idx+1. * @param idx position of first event in tracebuffer * @retval difference in CPU cycles * @return 0 if something wrong, 1 if everything ok */ PUBLIC static int Jdb_tbuf::diff_tsc(Mword idx, Signed64 *delta) { Tb_entry *e = lookup(idx); Tb_entry *e_prev = lookup(idx+1); if (!e || !e_prev) return false; *delta = e->tsc() - e_prev->tsc(); return true; }
/** Get difference CPU cycles between event idx and event idx+1 on the same CPU. * @param idx position of first event in tracebuffer * @retval difference in CPU cycles * @return 0 if something wrong, 1 if everything ok */ PUBLIC static int Jdb_tbuf::diff_tsc(Mword idx, Signed64 *delta) { Tb_entry *e = lookup(idx); Tb_entry *e_prev; if (!e) return false; do { e_prev = lookup(++idx); if (!e_prev) return false; } while (e->cpu() != e_prev->cpu()); *delta = e->tsc() - e_prev->tsc(); 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; }