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 authored and GitHub committed 2023-05-09 23:03:47 +02:00
commit 0f9e747583
2 files changed
+14 -7

No files matched your search

+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()