Merge pull request #2520 from matias-eduardo/master

Allow for custom sleep duration in tsc frequency fallback
This commit is contained in:
Jeroen van Rijn
2023-05-09 23:03:47 +02:00
committed by GitHub
2 changed files with 14 additions and 7 deletions
+2 -2
View File
@@ -70,7 +70,7 @@ has_invariant_tsc :: proc "contextless" () -> bool {
return false
}
tsc_frequency :: proc "contextless" () -> (u64, bool) {
tsc_frequency :: proc "contextless" (fallback_sleep := 2 * Second) -> (u64, bool) {
if !has_invariant_tsc() {
return 0, false
}
@@ -81,7 +81,7 @@ tsc_frequency :: proc "contextless" () -> (u64, bool) {
tsc_begin := intrinsics.read_cycle_counter()
tick_begin := tick_now()
sleep(2 * Second)
sleep(fallback_sleep)
tsc_end := intrinsics.read_cycle_counter()
tick_end := tick_now()