HxSysInfo
[!NOTE] Works on C++ only (hxcpp).
HxSysInfo is a Haxe library that can retrieve all kinds of information about the user's system. Only Windows, macOS, Linux, Android and iOS are supported.
| Platform | Compiles? | Tested? |
|---|---|---|
| Windows | Yes | Yes (Windows 11 23H2 x64, Windows 8.1 x86) |
| macOS | Yes | Yes (macOS Sonoma VMware Workstation Pro) |
| Linux | Yes | Yes (Lubuntu 24.04 LTS VMware Workstation Pro) |
| iOS | Yes | No |
| Android | Yes | No |
| Other | Unknown | No |
Installation
haxelib install HxSysInfo
Enter this command in the command prompt to get the latest release from the Haxe library.
After installing HxSysInfo, don't forget to add it to your Haxe project.
OpenFL projects
Add this to Project.xml to add HxSysInfo to your OpenFL project:
<haxelib name="HxSysInfo"/>
Haxe Projects
Add this to build.hxml to add HxSysInfo to your Haxe build.
-lib HxSysInfo
Usage
This example calls every method. It is also in the example folder, so you can build it with haxe build.hxml from there.
package;
import SysInfo;
import SysInfo.Converter;
#if (openfl && lime)
import SysInfo.OpenFLSysInfo;
#end
class Main {
static inline var LINE = "-----------------------------------------------------------";
static function names(items:Array<{name:String, on:Bool}>):String {
var on = [for (i in items) if (i.on) i.name];
return on.length > 0 ? on.join(", ") : "none";
}
static public function main() {
// Both methods return 0 at first, so we run them now
SysInfo.getCPUUsage();
SysInfo.getProcessCPUUsage();
Sys.println('OS: ${SysInfo.getOS()}');
Sys.println('Version: ${SysInfo.getOSVersion()}');
Sys.println('Kernel: ${SysInfo.getKernelVersion()}');
Sys.println('OS build: ${SysInfo.getOSBuild()}');
Sys.println('Windows name: ${SysInfo.getWindowsName()}');
Sys.println('Windows version: ${SysInfo.getWindowsVersion()}');
Sys.println('Architecture: ${SysInfo.getArchitecture()}');
Sys.println('User: ${SysInfo.getUsername()}');
Sys.println('Virtual machine: ${SysInfo.isVirtualMachine()}');
Sys.println(LINE);
Sys.println('Windows edition: ${SysInfo.getWindowsEdition()}');
Sys.println('Windows build number: ${SysInfo.getWindowsBuildNumber()}');
var installDate = SysInfo.getWindowsInstallDate();
Sys.println('Windows installed: ${installDate > 0 ? Std.string(Date.fromTime(installDate * 1000)) : "unknown"}');
Sys.println('Windows versions: ' + names([
{name: "7", on: SysInfo.isWindows7()},
{name: "8/8.1", on: SysInfo.isWindows8()},
{name: "10", on: SysInfo.isWindows10()},
{name: "11", on: SysInfo.isWindows11()},
{name: "Server", on: SysInfo.isWindowsServer()}
]));
Sys.println('Running as administrator: ${SysInfo.isElevated()}');
Sys.println('Dark mode: ${SysInfo.isDarkMode()}');
Sys.println('UEFI: ${SysInfo.isUEFI()}');
Sys.println('Secure Boot: ${SysInfo.isSecureBootEnabled()}');
Sys.println('TPM version: ${SysInfo.getTPMVersion()}');
Sys.println('Under Wine: ${SysInfo.isRunningUnderWine()}');
Sys.println('Under emulation (x86/x64 on ARM): ${SysInfo.isRunningUnderEmulation()}');
Sys.println(LINE);
Sys.println('Linux distro ID: ${SysInfo.getLinuxDistroID()}');
Sys.println('Linux distro like: ${SysInfo.getLinuxDistroLike()}');
Sys.println('Linux distro: ' + names([
{name: "Ubuntu", on: SysInfo.isUbuntu()}, {name: "Debian", on: SysInfo.isDebian()},
{name: "Fedora", on: SysInfo.isFedora()}, {name: "Arch", on: SysInfo.isArch()},
{name: "openSUSE", on: SysInfo.isOpenSUSE()}, {name: "SLES", on: SysInfo.isSLES()},
{name: "RHEL", on: SysInfo.isRHEL()}, {name: "CentOS", on: SysInfo.isCentOS()},
{name: "Rocky", on: SysInfo.isRockyLinux()}, {name: "Alma", on: SysInfo.isAlmaLinux()},
{name: "Mint", on: SysInfo.isLinuxMint()}, {name: "Pop!_OS", on: SysInfo.isPopOS()},
{name: "Manjaro", on: SysInfo.isManjaro()}, {name: "EndeavourOS", on: SysInfo.isEndeavourOS()},
{name: "Kali", on: SysInfo.isKali()}, {name: "NixOS", on: SysInfo.isNixOS()},
{name: "Gentoo", on: SysInfo.isGentoo()}, {name: "Alpine", on: SysInfo.isAlpine()},
{name: "Void", on: SysInfo.isVoid()}, {name: "Slackware", on: SysInfo.isSlackware()},
{name: "elementary", on: SysInfo.isElementaryOS()}, {name: "Zorin", on: SysInfo.isZorinOS()},
{name: "Deepin", on: SysInfo.isDeepin()}, {name: "SteamOS", on: SysInfo.isSteamOS()}
]));
Sys.println('Linux family: ' + names([
{name: "Debian", on: SysInfo.isDebianBased()}, {name: "Ubuntu", on: SysInfo.isUbuntuBased()},
{name: "Arch", on: SysInfo.isArchBased()}, {name: "Red Hat", on: SysInfo.isRedHatBased()},
{name: "Fedora", on: SysInfo.isFedoraBased()}, {name: "SUSE", on: SysInfo.isSUSEBased()},
{name: "Gentoo", on: SysInfo.isGentooBased()}, {name: "Alpine", on: SysInfo.isAlpineBased()},
{name: "Slackware", on: SysInfo.isSlackwareBased()}
]));
Sys.println(LINE);
Sys.println('CPU: ${SysInfo.getCPUName()}');
Sys.println('CPU vendor: ${SysInfo.getCPUVendor()}');
Sys.println('CPU cores (physical): ${SysInfo.getCPUCoreCount()}');
Sys.println('CPU threads (logical): ${SysInfo.getCPUThreadCount()}');
Sys.println('CPU frequency: ${SysInfo.getCPUFrequency()} MHz (max ${SysInfo.getCPUMaxFrequency()} MHz)');
Sys.println('CPU features: ${SysInfo.getCPUFeatures()}');
Sys.println('AVX2: ${SysInfo.hasCPUFeature("avx2")}');
Sys.println(LINE);
var totalRam = SysInfo.getTotalRAM();
var availableRam = SysInfo.getAvailableRAM();
Sys.println('Total RAM: ${totalRam} bytes (${Converter.toGiB(totalRam, 1)} gigabytes)');
Sys.println('Available RAM: ${availableRam} bytes (${Converter.toGiB(availableRam, 1)} gigabytes)');
Sys.println('RAM type: ${SysInfo.getRAMType()}');
Sys.println('RAM speed: ${SysInfo.getRAMSpeed()} MT/s');
var ramCapacity = SysInfo.getRAMTotalCapacity();
Sys.println('RAM slots: ${SysInfo.getRAMSlotCount()} (${SysInfo.getRAMModuleCount()} populated), capacity ${ramCapacity} bytes (${Converter.toGiB(ramCapacity, 1)} gigabytes)');
var totalSwap = SysInfo.getTotalSwap();
var freeSwap = SysInfo.getAvailableSwap();
Sys.println('Swap / page file: ${totalSwap} bytes total (${Converter.toGiB(totalSwap, 1)} gigabytes), ${freeSwap} bytes free (${Converter.toGiB(freeSwap, 1)} gigabytes)');
Sys.println(LINE);
var gpuCount = SysInfo.getGPUCount();
Sys.println('GPU count: $gpuCount');
for (i in 0...gpuCount) {
var vram = SysInfo.getGPUVRAM(i);
Sys.println('GPU $i name: ${SysInfo.getGPUName(i)}');
Sys.println('GPU $i driver: ${SysInfo.getGPUDriverVersion(i)}');
Sys.println('GPU $i VRAM: ${vram} bytes (${Converter.toGiB(vram, 1)} gigabytes)');
}
Sys.println(LINE);
var displayCount = SysInfo.getDisplayCount();
Sys.println('Display count: $displayCount');
for (i in 0...displayCount)
Sys.println('Display $i: ${SysInfo.getDisplayWidth(i)}x${SysInfo.getDisplayHeight(i)} @ ${SysInfo.getDisplayRefreshRate(i)} Hz');
Sys.println(LINE);
Sys.println('Battery: ${SysInfo.hasBattery() ? SysInfo.getBatteryLevel() + "%" + (SysInfo.isCharging() ? " (charging)" : "") : "none"}');
Sys.println(LINE);
Sys.println('Manufacturer: ${SysInfo.getManufacturer()}');
Sys.println('Model: ${SysInfo.getModel()}');
Sys.println('Hostname: ${SysInfo.getHostname()}');
Sys.println(LINE);
Sys.println('Uptime: ${SysInfo.getUptime()} seconds');
Sys.println('Booted: ${Date.fromTime(SysInfo.getBootTime() * 1000)}');
var osInstalled = SysInfo.getOSInstallDate();
Sys.println('OS installed: ${osInstalled > 0 ? Std.string(Date.fromTime(osInstalled * 1000)) : "unknown"}');
Sys.println(LINE);
var start = haxe.Timer.stamp();
var x = 0.0;
while (haxe.Timer.stamp() - start < 1.0)
x += Math.sqrt(x + 1);
Sys.println('CPU usage (whole system): ${SysInfo.getCPUUsage()}%');
Sys.println('CPU usage (this app): ${SysInfo.getProcessCPUUsage()}%');
var processMemory = SysInfo.getProcessMemory();
Sys.println('Memory used by this app: ${processMemory} bytes (${Converter.toMiB(processMemory, 1)} MiB)');
Sys.println(LINE);
var diskCount = SysInfo.getDiskCount();
Sys.println('Disk count: $diskCount');
Sys.println('System disk index: ${SysInfo.getSystemDiskIndex()}');
Sys.println(LINE);
for (i in 0...diskCount) {
Sys.println('Disk $i name: ${SysInfo.getDiskName(i)}');
Sys.println('Disk $i model: ${SysInfo.getDiskModel(i)}');
Sys.println('Disk $i serial: ${SysInfo.getDiskSerial(i)}');
Sys.println('Disk $i type: ${SysInfo.getDiskType(i)}');
var size = SysInfo.getDiskSize(i);
Sys.println('Disk $i size: ${size} bytes (${Converter.toTiB(size, 1)} terabytes)');
var partCount = SysInfo.getPartitionCount(i);
Sys.println('Disk $i partition count: $partCount');
for (j in 0...partCount) {
Sys.println('Disk $i partition $j name: ${SysInfo.getPartitionName(i, j)}');
Sys.println('Disk $i partition $j label: ${SysInfo.getPartitionLabel(i, j)}');
Sys.println('Disk $i partition $j file system: ${SysInfo.getPartitionFileSystem(i, j)}');
var psize = SysInfo.getPartitionSize(i, j);
var freesize = SysInfo.getPartitionFreeSpace(i, j);
Sys.println('Disk $i partition $j size: ${psize} bytes (${Converter.toGiB(psize, 1)} gigabytes)');
Sys.println('Disk $i partition $j free space: ${freesize} bytes (${Converter.toMiB(freesize, 1)} megabytes)');
}
Sys.println(LINE);
}
#if (openfl && lime)
var i = OpenFLSysInfo.getActiveGPUIndex();
trace(SysInfo.getGPUName(i), SysInfo.getGPUVRAM(i));
#end
}
}Example Real Output (Click to expand)
OS: Windows
Version: 10.0.22631
Kernel: 10.0.22631.7652
OS build: 22631.7652
Windows name: Windows 11
Windows version: 23H2
Architecture: x86_64
User: Thomas
Virtual machine: false
-----------------------------------------------------------
Windows edition: Enterprise
Windows build number: 22631
Windows installed: 2026-05-18 18:38:19
Windows versions: 11
Running as administrator: true
Dark mode: true
UEFI: true
Secure Boot: true
TPM version: 2.0
Under Wine: false
Under emulation (x86/x64 on ARM): false
-----------------------------------------------------------
Linux distro ID:
Linux distro like:
Linux distro: none
Linux family: none
-----------------------------------------------------------
CPU: AMD Ryzen 7 9800X3D 8-Core Processor
CPU vendor: AuthenticAMD
CPU cores (physical): 8
CPU threads (logical): 16
CPU frequency: 4662 MHz (max 4700 MHz)
CPU features: mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,aes,avx,fma,f16c,rdrand,bmi1,avx2,bmi2,avx512f,sha
AVX2: true
-----------------------------------------------------------
Total RAM: 33627140096 bytes (31.3 gigabytes)
Available RAM: 15354568704 bytes (14.3 gigabytes)
RAM type: DDR5
RAM speed: 6000 MT/s
RAM slots: 4 (2 populated), capacity 34359738368 bytes (32 gigabytes)
Swap / page file: 5100273664 bytes total (4.8 gigabytes), 4924645376 bytes free (4.6 gigabytes)
-----------------------------------------------------------
GPU count: 1
GPU 0 name: AMD Radeon RX 9070 XT
GPU 0 driver: 32.0.32015.12012
GPU 0 VRAM: 16977985536 bytes (15.8 gigabytes)
-----------------------------------------------------------
Display count: 1
Display 0: 2560x1440 @ 180 Hz
-----------------------------------------------------------
Battery: none
-----------------------------------------------------------
Manufacturer: Micro-Star International Co., Ltd.
Model: MS-7E86
Hostname: DESKTOP-IS2F7I4
-----------------------------------------------------------
Uptime: 892404.343 seconds
Booted: 2026-11-02 16:09:21
OS installed: 2026-05-18 18:38:19
-----------------------------------------------------------
CPU usage (whole system): 3.7037037037037%
CPU usage (this app): 1.23281563485186%
Memory used by this app: 12992512 bytes (12.4 MiB)
-----------------------------------------------------------
Disk count: 3
System disk index: 1
-----------------------------------------------------------
Disk 0 name: PhysicalDrive0
Disk 0 model: HI-LEVEL Elite Series 256GB
Disk 0 serial: NR22092321664
Disk 0 type: SSD
Disk 0 size: 256060514304 bytes (0.2 terabytes)
Disk 0 partition count: 1
Disk 0 partition 0 name: D:\
Disk 0 partition 0 label:
Disk 0 partition 0 file system: NTFS
Disk 0 partition 0 size: 256043384832 bytes (238.5 gigabytes)
Disk 0 partition 0 free space: 49634369536 bytes (47335 megabytes)
-----------------------------------------------------------
Disk 1 name: PhysicalDrive1
Disk 1 model: Samsung SSD 980 PRO with Heatsink 1TB
Disk 1 serial: 0025_38BC_3140_6FAA
Disk 1 type: SSD
Disk 1 size: 1000204886016 bytes (0.9 terabytes)
Disk 1 partition count: 4
Disk 1 partition 0 name: PhysicalDrive1 Partition1
Disk 1 partition 0 label:
Disk 1 partition 0 file system:
Disk 1 partition 0 size: 104857600 bytes (0.1 gigabytes)
Disk 1 partition 0 free space: 0 bytes (0 megabytes)
Disk 1 partition 1 name: PhysicalDrive1 Partition2
Disk 1 partition 1 label:
Disk 1 partition 1 file system:
Disk 1 partition 1 size: 16777216 bytes (0 gigabytes)
Disk 1 partition 1 free space: 0 bytes (0 megabytes)
Disk 1 partition 2 name: C:\
Disk 1 partition 2 label:
Disk 1 partition 2 file system: NTFS
Disk 1 partition 2 size: 998977306624 bytes (930.4 gigabytes)
Disk 1 partition 2 free space: 293304606720 bytes (279717.1 megabytes)
Disk 1 partition 3 name: PhysicalDrive1 Partition4
Disk 1 partition 3 label:
Disk 1 partition 3 file system:
Disk 1 partition 3 size: 1103101952 bytes (1 gigabytes)
Disk 1 partition 3 free space: 0 bytes (0 megabytes)
-----------------------------------------------------------
Disk 2 name: PhysicalDrive2
Disk 2 model: TransMemory
Disk 2 serial: BE0664E1B4F1
Disk 2 type: Removable
Disk 2 size: 62474158080 bytes (0.1 terabytes)
Disk 2 partition count: 1
Disk 2 partition 0 name: E:\ (CES_X64FREV)
Disk 2 partition 0 label: CES_X64FREV
Disk 2 partition 0 file system: FAT32
Disk 2 partition 0 size: 62473043968 bytes (58.2 gigabytes)
Disk 2 partition 0 free space: 59543126016 bytes (56784.8 megabytes)
-----------------------------------------------------------
Monitoring CPU usage
getCPUUsage() and getProcessCPUUsage() measure the time since the previous call, so poll them on a timer:
SysInfo.getProcessCPUUsage();
var timer = new haxe.Timer(1000);
timer.run = function() {
trace('System: ${SysInfo.getCPUUsage()}% This app: ${SysInfo.getProcessCPUUsage()}%');
};
Methods
Operating System
getOS():String
The platform name. Can be Windows, Linux, macOS, iOS or Android.
getOSVersion():String
The OS version. The format differs per platform.
getWindowsName():String
The Windows product name: Windows 10 or Windows 11. Windows Server editions return their full name (e.g. Windows Server 2025).
Returns "" on any platform other than Windows, or if it can't be determined.
getWindowsVersion():String
The Windows feature update version (e.g. 21H2, 22H2, 23H2, 24H2, 25H2, 26H2). Older Windows 10 releases return their release number instead (e.g. 1909, 2004).
Returns "" on any platform other than Windows, or if it can't be determined.
getArchitecture():String
The CPU architecture as reported by the OS (e.g. x86_64, ARM64, aarch64).
On iOS, this is not the CPU architecture. iOS reports the device hardware identifier instead.
On Linux and Android, a 32-bit build reports the real 64-bit host architecture.
On macOS, an Intel build running under Rosetta 2 on Apple Silicon correctly reports arm64, not the x86_64 the process sees itself as.
getKernelVersion():String
The kernel version.
- Windows: the NT version including the update revision (e.g.
10.0.22631.4317). - Linux and Android: the kernel release (e.g.
6.8.0-45-generic). - macOS and iOS: the Darwin kernel version (e.g.
23.6.0).
getOSBuild():String
The OS build identifier.
- Windows: build number plus update revision (e.g.
22631.4317). - macOS and iOS: the build string (e.g.
23G93). - Android: the build ID (e.g.
UP1A.231005.007). - Linux:
BUILD_IDfrom/etc/os-releaseif the distro sets it, otherwiseVERSION_ID.
Returns "" if it can't be determined.
getUsername():String
The name of the user running this process.
On iOS this is usually mobile. On Android it's the app's user (e.g. u0_a123).
isVirtualMachine():Bool
true if the system is running inside a virtual machine.
- Windows and Linux: detected through the hypervisor CPU flag and the firmware vendor strings. The Hyper-V host itself (when Hyper-V or virtualization-based security is on) is not reported as a VM.
- macOS: uses the OS's own VM flag.
- Android:
trueon the Android emulator. - iOS:
truein the iOS Simulator.
Containers (Docker, etc.) are not virtual machines and return false.
CPU
getCPUName():String
The CPU's model.
On iOS, this is the device hardware identifier instead of the CPU's model.
On Android, it depends on the device and can fall back to the chip's codename (e.g. lahaina) rather than a friendly CPU name.
getCPUCoreCount():Int
The physical CPU core count where the platform can determine it. Otherwise, the logical (thread) count is used as a fallback.
On architectures without SMT/hyperthreading (all iOS and Android devices), this is generally equal to getCPUThreadCount().
getCPUThreadCount():Int
The logical CPU count. Reflects currently online logical CPUs.
On platforms that can hot-plug cores for power saving (Android), this can be lower than the CPU's maximum count.
getCPUVendor():String
The CPU vendor.
x86 returns the vendor ID string (GenuineIntel, AuthenticAMD). ARM returns the implementer (e.g. Qualcomm, ARM). Apple platforms return Apple on Apple Silicon and iOS.
Returns "" if it can't be determined.
getCPUFeatures():String
A comma separated list of supported instruction set extensions. The names are the same on every platform.
- x86:
mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,avx512f,fma,aes,sha,popcnt,bmi1,bmi2,f16c,rdrand - ARM:
neon,aes,sha1,sha2,sha3,crc32,atomics,fp16,dotprod,sve,sve2
Only features from these lists are reported. Windows on ARM can report a subset of the ARM list.
hasCPUFeature(name:String):Bool
Checks whether the CPU supports a feature from getCPUFeatures(), e.g. SysInfo.hasCPUFeature("avx2"). The name is case insensitive.
getCPUFrequency():Int
The current CPU clock speed in MHz (averaged across cores). Returns 0 if it can't be determined.
- Windows: the live clock including boost, read from the same performance counters Task Manager uses. The first call takes about 100 ms while the counters warm up. Falls back to the rated clock if the counters are unavailable.
- macOS: only available on Intel Macs, and it's the nominal clock. Always
0on Apple Silicon. - iOS: always
0. - Linux and Android: read from the cpufreq driver. Falls back to
/proc/cpuinfoon Linux. Android may deny access to it.
getCPUMaxFrequency():Int
The maximum CPU clock speed in MHz (the highest across cores). Returns 0 if it can't be determined.
On Windows this is the CPU's rated (base) clock, because Windows doesn't expose the boost ceiling, so getCPUFrequency() can read higher while the CPU is boosting. On Linux this needs the cpufreq driver, so it's usually 0 in virtual machines. macOS and iOS: same limits as getCPUFrequency().
getCPUUsage():Float
System-wide CPU usage as a percentage (0 to 100) across all cores.
The value is the average since the previous call, so call it regularly (e.g. once per second). The first call only starts the measurement and returns 0. Calls less than 100 ms apart return the previous value.
Returns -1 if it can't be determined (Android 8+ blocks regular apps from reading it).
getProcessCPUUsage():Float
CPU usage of this application as a percentage (0 to 100) of the whole machine's capacity.
100 means every logical CPU is fully busy with this process, so a single thread running flat out on an 8-thread CPU reads 12.5. This matches the Windows Task Manager's per-process CPU column. Counts the CPU time of all threads in the process.
The value is the average since the previous call, so call it regularly (e.g. once per second). The first call only starts the measurement and returns 0. Calls less than 100 ms apart return the previous value.
Memory
getTotalRAM():Float
Total physical RAM in bytes.
On platforms where a portion of RAM can be reserved for hardware (e.g. Windows), this doesn't reflect the actual amount of physical RAM in the system. Instead, it reflects the maximum amount of RAM available to the system.
getAvailableRAM():Float
An estimate of available RAM in bytes.
This does not mean the same thing on every platform. On Linux and Android, it refers to memory that is currently free, so it may be lower than the amount of memory that can actually be used.
On macOS and iOS, it is based on both free and inactive memory, so it may also not represent the exact amount of memory available.
getProcessMemory():Float
Memory currently used by this application, in bytes.
- Windows: the working set.
- Linux, Android and macOS: the resident set size.
- iOS: the memory footprint, which is the value iOS uses to decide when to terminate an app.
getTotalSwap():Float
Total swap space (the page file on Windows) in bytes. Returns 0 if there is none. Always 0 on iOS.
getAvailableSwap():Float
Free swap space (the page file on Windows) in bytes. Returns 0 if there is none. Always 0 on iOS.
getRAMType():String
The RAM generation (e.g. DDR4, DDR5, LPDDR5).
Returns "" if it can't be determined.
- Windows: LPDDR4X is reported as
LPDDR4. - Linux: Requires root. Returns
""otherwise. - iOS and Android: always
"".
Virtual machines may report a wrong type, or none at all.
getRAMSpeed():Int
The RAM speed in MT/s. Returns 0 if it can't be determined.
This is the speed the RAM is actually configured to run at (so with XMP/EXPO off, it can be lower than the rating on the sticks). If sticks run at different speeds, the lowest is returned.
Apple Silicon Macs, iOS and Android always return 0.
getRAMSlotCount():Int
Number of memory slots on the motherboard. Returns 0 if it can't be determined.
- Linux: Requires root. Returns
0otherwise. - Apple Silicon Macs, iOS and Android: always
0.
Virtual machines may report a made up number.
getRAMModuleCount():Int
Number of memory slots that have a module installed. Returns 0 if it can't be determined. Same limits as getRAMSlotCount().
getRAMTotalCapacity():Float
Total size of all installed memory modules in bytes. Returns 0 if it can't be determined.
Unlike getTotalRAM(), this isn't reduced by memory reserved for hardware. Same limits as getRAMSlotCount().
GPU
getGPUCount():Int
Number of GPUs detected.
Always 0 or 1 on mobile platforms (iOS and Android).
Returns 0 on macOS running on a virtual machine (or a Hackintosh with no hardware-accelerated GPU).
getGPUName(index:Int):String
Name of the GPU at index.
Returns "" for an invalid range.
On Linux, some GPUs return the brand and family of the GPU (e.g., Advanced Micro Devices, Inc. [AMD/ATI] Navi 48 [Radeon RX 9070/9070 XT/9070 GRE]).
If the PCI ID database is outdated on the distro, it only returns the brand (e.g., Advanced Micro Devices, Inc. [AMD/ATI] Device).
Run sudo update-pciids in the terminal to update your PCI ID database.
getGPUVRAM(index:Int):Float
Dedicated VRAM of the GPU at index, in bytes.
Always 0 on macOS without a dedicated GPU, iOS and Android.
May return 0 if the GPU at index is integrated, the correct drivers are not installed, or the OS is running in a virtual machine.
getGPUDriverVersion(index:Int):String
Driver version of the GPU at index. Returns "" for an invalid index or if it can't be determined.
- Windows: the driver version. NVIDIA GPUs return the version number you see in the NVIDIA app (e.g.
551.23); other vendors return the raw version (e.g.31.0.21013.2007). - Linux: NVIDIA returns the driver version (e.g.
550.54.14). Other GPUs return the kernel driver name, plus its version if the kernel exposes one (e.g.amdgpu,i915). - Android: the OpenGL ES version string of the driver.
- macOS and iOS: always
"".
SysInfo.OpenFLSysInfo.getActiveGPUIndex():Int
[!WARNING] OpenFL and Lime only. Available in
SysInfo.OpenFLSysInfoclass.
Returns the index of the GPU currently rendering this OpenFL application.
Behavior may differ between platforms, so this is not guaranteed to return a valid index.
Returns -1 if the GPU index cannot be determined.
Displays
getDisplayCount():Int
Number of active displays. The primary display is always index 0.
- Linux: uses
xrandrwhen available, otherwise the DRM subsystem (which has no refresh rate). - Android: only works where the framebuffer info is readable, so it can be
0.
getDisplayWidth(index:Int):Int
Current width in pixels of the display at index. Returns 0 for an invalid index.
On iOS this is the screen's native resolution in portrait orientation.
getDisplayHeight(index:Int):Int
Current height in pixels of the display at index. Returns 0 for an invalid index.
On iOS this is the screen's native resolution in portrait orientation.
getDisplayRefreshRate(index:Int):Int
Refresh rate in Hz of the display at index. Returns 0 for an invalid index or if it can't be determined.
- macOS: built-in displays often report
0. - iOS: the highest refresh rate the screen supports (e.g.
120on ProMotion).
Battery
hasBattery():Bool
true if the device has a battery.
On Android this reads system files that newer versions may block, so it can be false on a phone.
getBatteryLevel():Int
Battery charge from 0 to 100. Returns -1 if there is no battery or it can't be determined. If there are several batteries, this is their average.
isCharging():Bool
true if the battery is charging. false if it's discharging, full, or there is no battery.
Device
getManufacturer():String
Device manufacturer (e.g. LENOVO, Dell Inc.).
Always Apple on macOS/iOS.
Can be "" on Linux, especially in VMs, containers, or ARM boards without SMBIOS.
getModel():String
Device model.
On Apple platforms, this is the internal hardware identifier (e.g. MacBookPro18,1, iPhone14,5).
getHostname():String
The machine's hostname.
On iOS, this always returns a placeholder, such as iPhone, rather than the user's real device name.
getUptime():Float
Seconds since boot.
On iOS and macOS, this is the time since the current OS session started.
It is not guaranteed to remain perfectly accurate across a system clock change, so it can drift if the clock is adjusted.
getBootTime():Float
When the system booted, as seconds since the Unix epoch (1970-01-01 UTC). Returns 0 if it can't be determined.
Pass it to Date.fromTime(bootTime * 1000) to get a date. On Windows, Android and iOS it's calculated from the uptime, so it has the same drift caveat as getUptime().
getOSInstallDate():Float
When the operating system was installed, as seconds since the Unix epoch (1970-01-01 UTC). Returns 0 if it can't be determined.
Pass it to Date.fromTime(installDate * 1000) to get a date.
- Windows: the install date recorded by Windows setup (same as
getWindowsInstallDate()). A feature update that reinstalls Windows can reset it. - Linux: the creation time of
/etc/machine-id, falling back to the root directory. Needs a file system that records creation times (ext4, btrfs and xfs do, on kernel 4.11 or newer). In a container this is when the image was built. - macOS: when Setup Assistant finished first-time setup. It survives OS upgrades.
- iOS and Android: always
0, because the OS doesn't expose it to apps.
Disks
getDiskCount():Int
Number of physical disks detected.
getDiskName(index:Int):String
OS device name of the disk at index.
Examples:
PhysicalDrive0(Windows)/dev/sda(Linux)/dev/disk0(macOS)
Returns "" for an invalid index.
getDiskModel(index:Int):String
Hardware model of the disk at index, when available.
Returns "" if the platform cannot provide it.
getDiskType(index:Int):String
Type of the disk.
Can be SSD, HDD, Removable or Unknown.
getDiskSize(index:Int):Float
Total size of the disk at index, in bytes.
Returns 0 for an invalid index.
getDiskSerial(index:Int):String
Serial number of the disk at index. Returns "" if it can't be determined or for an invalid index.
- Windows: from the storage driver. Some NVMe drives return a formatted value like
0025_388A_0123_4567. - Linux: read from sysfs or the udev database.
- macOS: looked up through the system profiler. This can add about a second to the first call.
- iOS and Android: always
"".
getSystemDiskIndex():Int
Index of the disk the OS is currently running from.
Returns -1 if it cannot be determined.
Always returns -1 on iOS.
Partitions
getPartitionCount(diskIndex:Int):Int
Number of partitions detected on the disk at diskIndex.
Returns 0 for an invalid index.
getPartitionName(diskIndex:Int, partIndex:Int):String
Name of a partition, usually its mount point, drive letter, or volume name.
Returns "" if unavailable.
getPartitionLabel(diskIndex:Int, partIndex:Int):String
Volume label of a partition (e.g. Windows, Backup).
Returns "" if the partition has no label or it can't be determined. Always "" on iOS and Android.
getPartitionFileSystem(diskIndex:Int, partIndex:Int):String
File system of a partition, such as NTFS, ext4 or APFS.
Returns "" if unavailable.
On Linux distributions running from a live environment rather than being
installed on the system, this returns "" because the partitions are not mounted.
getPartitionSize(diskIndex:Int, partIndex:Int):Float
Total size of a partition, in bytes.
Returns 0 for an invalid index.
getPartitionFreeSpace(diskIndex:Int, partIndex:Int):Float
Free space of a mounted partition, in bytes.
Returns 0 when it cannot be determined.
On macOS, an APFS container has no mount point of its own, so this is the free space shared by all volumes in the container.
It excludes purgeable space, so it may be lower than what Finder shows.
Returns 0 if none of the container's volumes is mounted.
Linux Distribution
These read /etc/os-release and only return true on desktop Linux. On Windows, macOS, iOS and Android they always return false (or "" for the string methods), so you can call them without any platform checks.
getLinuxDistroID():String
The ID field of /etc/os-release, lowercase (e.g. ubuntu, fedora, arch, opensuse-tumbleweed). Returns "" on other platforms or if the file can't be read.
getLinuxDistroLike():String
The ID_LIKE field as a comma separated list (e.g. ubuntu,debian on Linux Mint). Returns "" if the distro doesn't set it.
Exact distro checks
Each returns true only for that distro itself, not for its derivatives.
| Method | Matches |
|---|---|
isUbuntu():Bool | Ubuntu (all official flavors, e.g. Kubuntu and Xubuntu, report as Ubuntu). Derivatives like Linux Mint return false; use isUbuntuBased() for those. |
isDebian():Bool | Debian. Derivatives like Ubuntu return false; use isDebianBased() for those. |
isFedora():Bool | Fedora (all spins and editions). |
isArch():Bool | Arch Linux, including Arch Linux ARM. Derivatives like Manjaro return false; use isArchBased() for those. |
isOpenSUSE():Bool | openSUSE (Leap, Tumbleweed, MicroOS, and others). |
isSLES():Bool | SUSE Linux Enterprise (Server or Desktop). |
isRHEL():Bool | Red Hat Enterprise Linux. |
isCentOS():Bool | CentOS (including CentOS Stream). |
isRockyLinux():Bool | Rocky Linux. |
isAlmaLinux():Bool | AlmaLinux. |
isLinuxMint():Bool | Linux Mint. |
isPopOS():Bool | Pop!_OS. |
isManjaro():Bool | Manjaro (including Manjaro ARM). |
isEndeavourOS():Bool | EndeavourOS. |
isKali():Bool | Kali Linux. |
isNixOS():Bool | NixOS. |
isGentoo():Bool | Gentoo. |
isAlpine():Bool | Alpine Linux. This is the common base of Docker images. |
isVoid():Bool | Void Linux. |
isSlackware():Bool | Slackware. |
isElementaryOS():Bool | elementary OS. |
isZorinOS():Bool | Zorin OS. |
isDeepin():Bool | Deepin. |
isSteamOS():Bool | SteamOS, the OS of the Steam Deck. |
Family checks
Each returns true for the base distro and everything derived from it, using ID_LIKE.
| Method | Matches |
|---|---|
isDebianBased():Bool | Debian or any distro derived from it (Ubuntu, Linux Mint, Pop!_OS, Kali, and so on). |
isUbuntuBased():Bool | Ubuntu or any distro derived from it (Linux Mint, Pop!_OS, elementary OS, Zorin OS, and so on). |
isArchBased():Bool | Arch Linux or any distro derived from it (Manjaro, EndeavourOS, SteamOS, and so on). |
isRedHatBased():Bool | Red Hat Enterprise Linux, Fedora, CentOS, or any distro derived from them (Rocky Linux, AlmaLinux, Oracle Linux, and so on). |
isSUSEBased():Bool | openSUSE, SUSE Linux Enterprise, or any distro derived from them. |
isFedoraBased():Bool | Fedora or any distro derived from it (Bazzite, Nobara, Ultramarine, and so on). RHEL and its clones (CentOS, Rocky Linux, AlmaLinux, Oracle Linux, Amazon Linux) return false even though they list Fedora in ID_LIKE; use isRedHatBased() for those. |
isGentooBased():Bool | Gentoo or any distro derived from it (Funtoo, Calculate Linux, and so on). |
isAlpineBased():Bool | Alpine Linux or any distro derived from it (postmarketOS, and so on). |
isSlackwareBased():Bool | Slackware or any distro derived from it (Salix, Porteus, and so on). |
if (SysInfo.isSteamOS()) {
trace("Running on a Steam Deck");
} else if (SysInfo.isUbuntuBased()) {
trace("Ubuntu or a derivative, e.g. " + SysInfo.getLinuxDistroID());
}
Windows
These are Windows only. On Linux, macOS, iOS and Android they always return false ("" or 0 for the others), so you can call them without platform checks.
| Method | Description |
|---|---|
isWindows7():Bool | true on Windows 7. |
isWindows8():Bool | true on Windows 8 and 8.1. |
isWindows10():Bool | true on Windows 10. Windows Server and Windows 11 return false. |
isWindows11():Bool | true on Windows 11. Windows Server returns false. |
isWindowsServer():Bool | true on any Windows Server edition, including Server Core. |
getWindowsEdition():String | The Windows edition ID, e.g. Core (Home), Professional, Enterprise, Education or ServerStandard. Returns "" if it can't be determined. |
getWindowsBuildNumber():Int | The Windows build number, e.g. 22631. Easier than parsing getOSVersion() when you need a numeric comparison (Windows 11 starts at 22000). Returns 0 if it can't be determined. |
getWindowsInstallDate():Float | When Windows was first installed, as seconds since the Unix epoch (1970-01-01 UTC). Returns 0 if it can't be determined. Feature updates that reinstall Windows can reset it. |
isElevated():Bool | true if this process is running with administrator rights ("Run as administrator"). |
isDarkMode():Bool | true if the user has set apps to use the dark theme in Windows settings. |
isUEFI():Bool | true if Windows was booted in UEFI mode, false for legacy BIOS boot. |
isSecureBootEnabled():Bool | true if Secure Boot is turned on. |
getTPMVersion():String | The version of the TPM (Trusted Platform Module) chip: 2.0 or 1.2. Returns "" if there is no TPM or it's disabled. |
isRunningUnderWine():Bool | true if this program is running under Wine (e.g. on Linux or the Steam Deck through Proton) instead of real Windows. |
isRunningUnderEmulation():Bool | true if this is an x86 or x64 build running through emulation on a Windows on ARM PC. A 32-bit build on a normal 64-bit Windows PC returns false. |
if (SysInfo.isWindows11() && !SysInfo.isRunningUnderWine()) {
trace('Windows 11 ${SysInfo.getWindowsVersion()} (${SysInfo.getWindowsEdition()}), TPM ${SysInfo.getTPMVersion()}');
}
Unit Conversion
SysInfo always returns bytes for memory and storage. SysInfo.Converter provides helper methods for converting byte values returned by the library into other units.
All methods accept an optional decimal parameter:
- If
decimalis greater than0, the result is rounded to the specified number of decimal places. - If
decimalis-1or below, the result is rounded to the nearest whole number. - If
decimalis0, the result is not rounded.
toBit(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to bits.
toKiB(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to kibibytes (kilobytes).
toMiB(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to mebibytes (megabytes).
toGiB(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to gibibytes (gigabytes).
toTiB(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to tebibytes (terabytes).
toPiB(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to pebibytes (petabytes).
toEiB(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to exbibytes (exabytes).
toZiB(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to zebibytes (zettabytes).
toYiB(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to yobibytes (yottabytes).
toRiB(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to robibytes (ronnabytes).
toQiB(bytes:Float, decimal:Int = 0):Float
Converts the specified number of bytes to quebibytes (quettabytes).