use the correct frequency for the arm tsc timer
This commit is contained in:
1 parent
b88f9194d0
commit
1848e0df05
5 files changed
+22
-1
No files matched your search
@@ -1,13 +1,14 @@
|
||||
#+private
|
||||
package time
|
||||
|
||||
import "base:intrinsics"
|
||||
import "core:sys/unix"
|
||||
|
||||
_get_tsc_frequency :: proc "contextless" () -> (freq: u64, ok: bool) {
|
||||
if ODIN_ARCH == .amd64 {
|
||||
unix.sysctlbyname("machdep.tsc.frequency", &freq) or_return
|
||||
} else if ODIN_ARCH == .arm64 {
|
||||
unix.sysctlbyname("hw.tbfrequency", &freq) or_return
|
||||
freq = u64(intrinsics.arm64_read_cycle_counter_frequency())
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user