Skip to main content

Module boot_timestamp

Module boot_timestamp 

Source
Expand description

Boot timestamp : TSC-based elapsed time from kernel entry.

Captures rdtsc() at the very start of kernel_main and exposes elapsed_ms() / elapsed_us() for boot milestone logging.

Before APIC timer calibration the TSC frequency is unknown, so we use a conservative default (2 GHz). Call calibrate() once the real frequency is known to get accurate readings.

Staticsยง

BOOT_TSC ๐Ÿ”’
TSC value captured at kernel entry.
TSC_KHZ ๐Ÿ”’
TSC frequency in KHz. Default 2_000_000 KHz (= 2 GHz) until calibrated.

Functionsยง

calibrate
Refine TSC frequency after timer calibration.
calibrate_khz
Set TSC frequency directly (used for CPUID leaf 0x15 calibration).
elapsed_ms
Milliseconds elapsed since kernel entry.
elapsed_tsc ๐Ÿ”’
TSC ticks elapsed since init().
elapsed_us
Microseconds elapsed since kernel entry.
init
Capture the boot TSC. Must be called once, as early as possible.
tsc_khz
Current TSC frequency in KHz (for external conversions).