mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
update linux-arm to use the asm intrin for freq
This commit is contained in:
@@ -5,6 +5,10 @@ package time
|
||||
import linux "core:sys/linux"
|
||||
|
||||
_get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
||||
if ODIN_ARCH == .arm64 {
|
||||
freq = u64(intrinsics.arm64_read_cycle_counter_frequency())
|
||||
return frequency, true
|
||||
} else {
|
||||
// Get the file descriptor for the perf mapping
|
||||
perf_attr := linux.Perf_Event_Attr{}
|
||||
perf_attr.size = size_of(perf_attr)
|
||||
@@ -30,4 +34,5 @@ _get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
||||
}
|
||||
frequency := u64((u128(1_000_000_000) << u128(event_page.time_shift)) / u128(event_page.time_mult))
|
||||
return frequency, true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user