UEFIStarter
a simple UEFI framework
|
Timing functions. More...
#include <Library/UefiBootServicesTableLib.h>
#include <UEFIStarter/core/timestamp.h>
#include <UEFIStarter/core/logger.h>
#include <UEFIStarter/core/string.h>
Functions | |
int | init_timestamps () |
Initializes the timestamp features. More... | |
UINT64 | get_timestamp () |
Fetches and returns the current timestamp. More... | |
double | timestamp_diff_seconds (UINT64 start, UINT64 end) |
Calculates the number of seconds between two timestamps. More... | |
UINT64 | get_timestamp_ticks_per_second () |
Returns the number of timestamp ticks per second. More... | |
Variables | |
UINT64 | _rdtsc_ticks_per_second =0 |
internal storage for the number of timestamp ticks per second | |
int init_timestamps | ( | ) |
Initializes the timestamp features.
This will take ~2 seconds at current settings. This function takes the naive approach and simply measures how many ticks pass in 2 seconds. This tick frequency will be used later when converting ticks to seconds.
Make sure to call this function before you attempt to determine elapsed wallclock time.
UINT64 get_timestamp | ( | ) |
Fetches and returns the current timestamp.
double timestamp_diff_seconds | ( | UINT64 | start, |
UINT64 | end | ||
) |
Calculates the number of seconds between two timestamps.
This will only work if init_timestamps() has been called first.
start | the start of the timestamp interval |
end | the end of the timestamp interval |
UINT64 get_timestamp_ticks_per_second | ( | ) |
Returns the number of timestamp ticks per second.