/** * timecounter_read_delta - get nanoseconds since last call of this function * @tc: Pointer to time counter * * When the underlying cycle counter runs over, this will be handled * correctly as long as it does not run over more than once between * calls. * * The first call to this function for a new time counter initializes * the time tracking and returns an undefined result.
*/ static u64 timecounter_read_delta(struct timecounter *tc)
{
u64 cycle_now, cycle_delta;
u64 ns_offset;
/* * This is like cyclecounter_cyc2ns(), but it is used for computing a * time previous to the time stored in the cycle counter.
*/ static u64 cc_cyc2ns_backwards(conststruct cyclecounter *cc,
u64 cycles, u64 mask, u64 frac)
{
u64 ns = (u64) cycles;
/* * Instead of always treating cycle_tstamp as more recent * than tc->cycle_last, detect when it is too far in the * future and treat it as old time stamp instead.
*/ if (delta > tc->cc->mask / 2) {
delta = (tc->cycle_last - cycle_tstamp) & tc->cc->mask;
nsec -= cc_cyc2ns_backwards(tc->cc, delta, tc->mask, frac);
} else {
nsec += cyclecounter_cyc2ns(tc->cc, delta, tc->mask, &frac);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.