time stamp counter related functions
More...
Go to the source code of this file.
time stamp counter related functions
- Date
- 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).
- Examples
- examples/sys/aliens/main.c.
Definition at line 181 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()
◆ 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 207 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 229 of file rdtsc.h.
◆ l4_rdtsc()
◆ l4_rdtsc_32()
Read the lest significant 32 bit of the TSC.
Useful for smaller differences, needs less cycles.
Definition at line 248 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.
Referenced by l4_calibrate_tsc().
◆ l4_tsc_to_ns()
◆ 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 290 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 276 of file rdtsc.h.