SystemInfo
class SystemInfo
System information utilities for benchmarking and diagnostics.
Provides cross-platform detection of CPU cores, memory, and virtualization. All methods fail gracefully and return null when information is unavailable.
Methods
Get the number of CPU cores available.
Get total system memory as a human-readable string.
Detect virtualization type if running in a VM or container.
Get PHP memory limit in bytes.
Get current PHP memory limit as human-readable string.
Details
at line 22
int|null
getCpuCores()
Get the number of CPU cores available.
Supports Linux (/proc/cpuinfo), macOS (sysctl), and Windows (environment variable).
at line 58
string|null
getTotalMemory()
Get total system memory as a human-readable string.
Supports Linux (/proc/meminfo), macOS (sysctl), and Windows (wmic).
at line 94
string|null
detectVirtualization()
Detect virtualization type if running in a VM or container.
Returns the detected type (VirtualBox, VMware, KVM, Docker, etc.) or null if not detected.
at line 148
int
getMemoryLimitBytes()
Get PHP memory limit in bytes.
at line 172
string
getMemoryLimitFormatted()
Get current PHP memory limit as human-readable string.