time stamp counter related functions
More...
Go to the source code of this file.
time stamp counter related functions
- Author
- Frank Mehnert fm3@o.nosp@m.s.in.nosp@m.f.tu-.nosp@m.dres.nosp@m.den.d.nosp@m.e
Definition in file rdtsc.h.
◆ l4_busy_wait_ns()
◆ l4_busy_wait_us()
◆ l4_calibrate_tsc()
Calibrate scalers for time stamp calculations.
Determine some scalers to be able to convert between real time and CPU ticks. This test uses channel 0 of the PIT (i8254) or the kernel KIP, depending on availability. Just calls l4_tsc_init(L4_TSC_INIT_AUTO).
Definition at line 183 of file rdtsc.h.
References l4_tsc_init(), and L4_TSC_INIT_AUTO.
◆ l4_get_hz()
Get CPU frequency in Hz.
- Returns
- frequency in Hz
◆ l4_ns_to_tsc()
Convert nano seconds into CPU ticks.
- Parameters
-
- Returns
- CPU ticks
Definition at line 321 of file rdtsc.h.
◆ l4_rdpmc()
Return current value of CPU-internal performance measurement counter.
- Parameters
-
ecx | ECX value for the rdpmc instruction. For details see the Intel IA-32 Architectures Software Developer's Manual. |
- Returns
- 64-bit PMC
Definition at line 222 of file rdtsc.h.
◆ l4_rdpmc_32()
Return the least significant 32 bit of a performance counter.
Useful for smaller differences, needs less cycles.
Definition at line 239 of file rdtsc.h.
◆ l4_rdtsc()
Read current value of CPU-internal time stamp counter.
- Returns
- 64-bit time stamp
Definition at line 189 of file rdtsc.h.
◆ l4_rdtsc_32()
Read the lest significant 32 bit of the TSC.
Useful for smaller differences, needs less cycles.
Definition at line 208 of file rdtsc.h.
◆ l4_tsc_init()
Initialize scaler for TSC calibrations.
Initialize the scalers needed by l4_tsc_to_ns()/l4_ns_to_tsc() and so on. Current versions of Fiasco export these scalers from kernel into userland. The programmer may decide whether he allows to use these scalers or if an calibration should be performed.
- Parameters
-
constraint | programmers constraint:
- L4_TSC_INIT_AUTO if the kernel exports the scalers then use them. If not, perform calibration using channel 0 of the PIT (i8254). The latter case may lead into short (unpredictable) periods where interrupts are disabled.
- L4_TSC_INIT_KERNEL depend on retrieving the scalers from kernel. If the scalers are not available, return 0.
- L4_TSC_INIT_CALIBRATE Ignore possible scalers exported by the scaler, instead insist on calibration using the PIT.
|
kip | KIP pointer |
- Returns
- 0 on error (no scalers exported by kernel, calibrating failed ...) otherwise returns (2^32 / (tsc per µsec)). This value has the same semantics as the value returned by the calibrate_delay_loop() function of the Linux kernel.
◆ l4_tsc_to_ns()
Convert time stamp to ns value.
- Parameters
-
tsc | time value in CPU ticks |
- Returns
- time value in ns
Definition at line 253 of file rdtsc.h.
◆ l4_tsc_to_s_and_ns()
Convert time stamp to s.ns value.
- Parameters
-
tsc | time value in CPU ticks |
- Return values
-
Definition at line 299 of file rdtsc.h.
◆ l4_tsc_to_us()
Convert time stamp into micro seconds value.
- Parameters
-
tsc | time value in CPU ticks |
- Returns
- time value in micro seconds
Definition at line 277 of file rdtsc.h.