mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +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"
|
import linux "core:sys/linux"
|
||||||
|
|
||||||
_get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
_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
|
// Get the file descriptor for the perf mapping
|
||||||
perf_attr := linux.Perf_Event_Attr{}
|
perf_attr := linux.Perf_Event_Attr{}
|
||||||
perf_attr.size = size_of(perf_attr)
|
perf_attr.size = size_of(perf_attr)
|
||||||
@@ -31,3 +35,4 @@ _get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
|||||||
frequency := u64((u128(1_000_000_000) << u128(event_page.time_shift)) / u128(event_page.time_mult))
|
frequency := u64((u128(1_000_000_000) << u128(event_page.time_shift)) / u128(event_page.time_mult))
|
||||||
return frequency, true
|
return frequency, true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user