aboutsummaryrefslogtreecommitdiff
path: root/core/sys/info/cpu_arm.odin
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2025-05-25 19:43:10 +0200
committerGitHub <noreply@github.com>2025-05-25 19:43:10 +0200
commit655fab7227fbd92837c82fdbeea65c9121b0f70b (patch)
treec7c4b24837d94e140cdef5f5f0458cdf04b0c69a /core/sys/info/cpu_arm.odin
parent0a6dced9daf6baa1b2e81b7d5542899ca6022c7e (diff)
Add core/hyperthread count for Windows and Linux (#5216)
Add core/hyperthread count to `core:sys/info` for Windows and Linux. TODO: Linux RISCV, Linux ARM, Darwin, and the BSDs.
Diffstat (limited to 'core/sys/info/cpu_arm.odin')
-rw-r--r--core/sys/info/cpu_arm.odin16
1 files changed, 10 insertions, 6 deletions
diff --git a/core/sys/info/cpu_arm.odin b/core/sys/info/cpu_arm.odin
index 960e55a56..8f5143394 100644
--- a/core/sys/info/cpu_arm.odin
+++ b/core/sys/info/cpu_arm.odin
@@ -40,9 +40,13 @@ CPU_Feature :: enum u64 {
}
CPU_Features :: distinct bit_set[CPU_Feature; u64]
-
-cpu_features: Maybe(CPU_Features)
-cpu_name: Maybe(string)
+CPU :: struct {
+ name: Maybe(string),
+ features: Maybe(CPU_Features),
+ physical_cores: int,
+ logical_cores: int,
+}
+cpu: CPU
@(private)
cpu_name_buf: [128]byte
@@ -53,7 +57,7 @@ init_cpu_name :: proc "contextless" () {
when ODIN_OS == .Darwin {
if unix.sysctlbyname("machdep.cpu.brand_string", &cpu_name_buf) {
- cpu_name = string(cstring(rawptr(&cpu_name_buf)))
+ cpu.name = string(cstring(rawptr(&cpu_name_buf)))
generic = false
}
}
@@ -61,10 +65,10 @@ init_cpu_name :: proc "contextless" () {
if generic {
when ODIN_ARCH == .arm64 {
copy(cpu_name_buf[:], "ARM64")
- cpu_name = string(cpu_name_buf[:len("ARM64")])
+ cpu.name = string(cpu_name_buf[:len("ARM64")])
} else {
copy(cpu_name_buf[:], "ARM")
- cpu_name = string(cpu_name_buf[:len("ARM")])
+ cpu.name = string(cpu_name_buf[:len("ARM")])
}
}
}