core/sys/info

sysinfo

Types

9

CPU_Feature

CPU_Feature :: enum u64 { aes = 0, // AES hardware implementation (AES NI) adx = 1, // Multi-precision add-carry instruction extensions avx = 2, // Advanced vector extension avx2 = 3, // Advanced vector extension 2 bmi1 = 4, // Bit manipulation instruction set 1 bmi2 = 5, // Bit manipulation instruction set 2 erms = 6, // Enhanced REP for MOVSB and STOSB fma = 7, // Fused-multiply-add instructions os_xsave = 8, // OS supports XSAVE/XRESTOR for saving/restoring XMM registers. pclmulqdq = 9, // PCLMULQDQ instruction - most often used for AES-GCM popcnt = 10, // Hamming weight instruction POPCNT. rdrand = 11, // RDRAND instruction (on-chip random number generator) rdseed = 12, // RDSEED instruction (on-chip random number generator) sha = 13, // SHA Extensions (SHA-1, SHA-224, SHA-256) sse2 = 14, // Streaming SIMD extension 2 (always available on amd64) sse3 = 15, // Streaming SIMD extension 3 ssse3 = 16, // Supplemental streaming SIMD extension 3 sse41 = 17, // Streaming SIMD extension 4 and 4.1 sse42 = 18, // Streaming SIMD extension 4 and 4.2 avx512bf16 = 19, // Vector Neural Network Instructions supporting bfloat16 avx512bitalg = 20, // Bit Algorithms avx512bw = 21, // Byte and Word instructions avx512cd = 22, // Conflict Detection instructions avx512dq = 23, // Doubleword and Quadword instructions avx512er = 24, // Exponential and Reciprocal instructions avx512f = 25, // Foundation avx512fp16 = 26, // Vector 16-bit float instructions avx512ifma = 27, // Integer Fused Multiply Add avx512pf = 28, // Prefetch instructions avx512vbmi = 29, // Vector Byte Manipulation Instructions avx512vbmi2 = 30, // Vector Byte Manipulation Instructions 2 avx512vl = 31, // Vector Length extensions avx512vnni = 32, // Vector Neural Network Instructions avx512vp2intersect = 33, // Vector Pair Intersection to a Pair of Mask Registers avx512vpopcntdq = 34, // Vector Population Count for Doubleword and Quadword }Source

Constants

2

Procedures

7

cpu_core_count

cpu_core_count :: proc() -> (physical: int, logical: int, ok: bool)Source

Retrieves the number of physical and logical CPU cores

  • physical: The number of physical cores
  • logical: The number of logical cores
  • ok: true when we could retrieve the CPU information, false otherwise

cpu_features

cpu_features :: proc() -> (features: CPU_Features)Source

Returns CPU features where available

The results are looked up before main enters and cached

  • features: An architecture-specific bit_set, empty if we couldn't retrieve them

cpu_name

cpu_name :: proc() -> (name: string)Source

Returns the CPU's name

The results are looked up before main enters and cached

  • name: A string containing the CPU model name, empty if the lookup failed

iterate_gpus

iterate_gpus :: proc(it: ^GPU_Iterator, minimum_vram: i64 = i64(256 * 1024 * 1024)) -> (gpu: GPU, index: int, ok: bool)Source

Iterates over GPU adapters

On Windows: Enumerates Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318} Elsewhere: Unsupported at the moment, returns {}, 0, false

Important: The vendor name, model name and driver version strings are backed by the GPU_Iterator. Clone them if you want to these to persist.

  • it: A pointer to a GPU_Iterator
  • minimum_vram: The number of bytes of VRAM an adapter has to have to be considered, default 256 MiB

(This excludes most screen mirroring / remote desktop drivers)

gpu:    A `GPU` struct which contains `vendor` name, `model` name, `driver` version and `vram` in bytes
	index:  Loop index, optional
	ok:     `true` if this was a success and we should continue, `false` otherwise

os_version

os_version :: proc(allocator: runtime.Allocator, loc = #caller_location) -> (res: OS_Version, ok: bool)Source

Retrieves OS version information

Allocates Using Provided Allocator

You can use destroy_os_version to free the results

  • allocator: A runtime.Allocator on which the version strings will be allocated
  • loc: The caller location
  • res: An OS_Version struct
  • ok: true when we could retrieve OS version information, false otherwise

ram_stats

ram_stats :: proc() -> (total_ram: i64, free_ram: i64, total_swap: i64, free_swap: i64, ok: bool)Source

Retrieves RAM statistics

Unavailable stats will be returned as 0 bytes

  • total_ram: Total RAM reported by the operating system, in bytes
  • free_ram: Free RAM reported by the operating system, in bytes
  • total_swap: Total SWAP reported by the operating system, in bytes
  • free_swap: Free SWAP reported by the operating system, in bytes
  • ok: true when we could retrieve RAM statistics, false otherwise

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.