Struct TscTimePoint

A time point maintained through the TSC timer

struct TscTimePoint ;

TSC is a time counter maintained directly by the CPU. It counts how many "cycles" (loosly corresponding to actual CPU cycles) since an arbitrary start point. It is read by a single assembly instruciton, and is more efficient to read than kernel operatons.

Fields

NameTypeDescription
cycles longTime represented by TscTimePoint in units of cycles.
cyclesPerMsec immutable(long)Provide the cycles/time ratio for the current machine.
cyclesPerMsecDivisor immutable(S64Divisor)Prepared dividor for the cycles/time value
cyclesPerSecond immutable(long)Provide the cycles/time ratio for the current machine.
cyclesPerSecondDivisor immutable(S64Divisor)Prepared dividor for the cycles/time value
cyclesPerUsec immutable(long)Provide the cycles/time ratio for the current machine.
cyclesPerUsecDivisor immutable(S64Divisor)Prepared dividor for the cycles/time value

Methods

NameDescription
diff Calculate difference between two TscTimePoint in the given units
fromNow Calculate a TscTimePoint for a set duration from now
fromSysTime Calculate a TscTimePoint for a time given in systime from now
hardNow Get a TscTimePoint representing now.
now Get a TscTimePoint representing now.
setHardNowThreshold Set the frequency with which we take a hard TSC reading
to Convert to any of the units accepted by toDuration
toCycles Various conversion functions
toDuration Various conversion functions
toMsecs Various conversion functions
toUsecs Various conversion functions

Aliases

NameDescription
frequency Provide the cycles/time ratio for the current machine.