mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-08 00:28:49 +00:00
more function name changes
This commit is contained in:
+3
-3
@@ -54,10 +54,10 @@ when ODIN_ARCH == .amd64 {
|
||||
_, _, _, edx := intrinsics.x86_cpuid(0x80_000_007, 0)
|
||||
return (edx & (1 << 8)) != 0
|
||||
}
|
||||
|
||||
x86_get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
||||
return _x86_get_tsc_frequency()
|
||||
}
|
||||
|
||||
get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
||||
return _get_tsc_frequency()
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -9,8 +9,7 @@ foreign libc {
|
||||
@(link_name="sysctlbyname") _sysctlbyname :: proc(path: cstring, oldp: rawptr, oldlenp: rawptr, newp: rawptr, newlen: int) -> c.int ---
|
||||
}
|
||||
|
||||
when ODIN_ARCH == .amd64 {
|
||||
_x86_get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
||||
_get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
||||
tmp_freq : u64 = 0
|
||||
tmp_size : i64 = size_of(tmp_freq)
|
||||
ret := _sysctlbyname("machdep.tsc.frequency", &tmp_freq, &tmp_size, nil, 0)
|
||||
@@ -20,4 +19,3 @@ when ODIN_ARCH == .amd64 {
|
||||
|
||||
return tmp_freq, true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ package time
|
||||
import "core:intrinsics"
|
||||
import "core:sys/unix"
|
||||
|
||||
when ODIN_ARCH == .amd64 {
|
||||
_x86_get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
||||
_get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
||||
perf_attr := unix.Perf_Event_Attr{}
|
||||
perf_attr.type = u32(unix.Perf_Type_Id.Hardware)
|
||||
perf_attr.config = u64(unix.Perf_Hardware_Id.Instructions)
|
||||
@@ -34,4 +33,3 @@ when ODIN_ARCH == .amd64 {
|
||||
frequency := u64((u128(1_000_000_000) << u128(event_page.time_shift)) / u128(event_page.time_mult))
|
||||
return frequency, true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ package time
|
||||
import "core:intrinsics"
|
||||
import win32 "core:sys/windows"
|
||||
|
||||
when ODIN_ARCH == .amd64 {
|
||||
_x86_get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
||||
_get_tsc_frequency :: proc "contextless" () -> (u64, bool) {
|
||||
qpc_begin: win32.LARGE_INTEGER
|
||||
win32.QueryPerformanceCounter(&qpc_begin)
|
||||
tsc_begin := intrinsics.read_cycle_counter()
|
||||
@@ -23,4 +22,3 @@ when ODIN_ARCH == .amd64 {
|
||||
frequency = u64((u128(tsc_end - tsc_begin) * u128(qpc_frequency)) / u128(qpc_end - qpc_begin))
|
||||
return frequency, true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user