mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-04 12:07:45 +00:00
18 lines
377 B
Odin
18 lines
377 B
Odin
#+private
|
|
package time
|
|
|
|
import "base:intrinsics"
|
|
@require import "core:sys/unix"
|
|
|
|
_get_tsc_frequency :: proc "contextless" () -> (freq: u64, ok: bool) {
|
|
when ODIN_ARCH == .amd64 {
|
|
unix.sysctlbyname("machdep.tsc.frequency", &freq) or_return
|
|
} else when ODIN_ARCH == .arm64 {
|
|
freq = u64(intrinsics.read_cycle_counter_frequency())
|
|
} else {
|
|
return
|
|
}
|
|
ok = true
|
|
return
|
|
}
|