Loading...
Searching...
No Matches
juce::SystemStats Class Referencefinal

## Detailed Description

Contains methods for finding out about the current hardware and OS configuration.

The documentation for this class was generated from the following file:

- juce_core/system/juce_SystemStats.h

## Public Types

enum

OperatingSystemType {
UnknownOS = 0 , MacOSX = 0x0100 , Windows = 0x0200 , Linux = 0x0400 ,
Android = 0x0800 , iOS = 0x1000 , WASM = 0x2000 , MacOSX_10_7 = MacOSX | 7 ,
MacOSX_10_8 = MacOSX | 8 , MacOSX_10_9 = MacOSX | 9 , MacOSX_10_10 = MacOSX | 10 , MacOSX_10_11 = MacOSX | 11 ,
MacOSX_10_12 = MacOSX | 12 , MacOSX_10_13 = MacOSX | 13 , MacOSX_10_14 = MacOSX | 14 , MacOSX_10_15 = MacOSX | 15 ,
MacOS_11 = MacOSX | 16 , MacOS_12 = MacOSX | 17 , MacOS_13 = MacOSX | 18 , MacOS_14 = MacOSX | 19 ,
MacOS_15 = MacOSX | 20 , MacOS_26 = MacOSX | 21 , Win2000 = Windows | 1 , WinXP = Windows | 2 ,
WinVista = Windows | 3 , Windows7 = Windows | 4 , Windows8_0 = Windows | 5 , Windows8_1 = Windows | 6 ,
Windows10 = Windows | 7 , Windows11 = Windows | 8
}

| The set of possible results of the getOperatingSystemType() method. More...
enum class | MachineIdFlags { macAddresses = 1 << 0 , fileSystemId = 1 << 1 , legacyUniqueId = 1 << 2 , uniqueId = 1 << 3 }
| Kinds of identifier that are passed to getMachineIdentifiers(). More...
using | CrashHandlerFunction = void (*) (void*)
| A function type for use in setApplicationCrashHandler().

## Static Public Member Functions

static String | getJUCEVersion ()
| Returns the current version of JUCE, See also the JUCE_VERSION, JUCE_MAJOR_VERSION and JUCE_MINOR_VERSION macros.
static OperatingSystemType | getOperatingSystemType ()
| Returns the type of operating system we're running on.
static String | getOperatingSystemName ()
| Returns the name of the type of operating system we're running on.
static bool | isOperatingSystem64Bit ()
| Returns true if the OS is 64-bit, or false for a 32-bit OS.
static String | getEnvironmentVariable (const String &name, const String &defaultValue)
| Returns an environment variable.
static String | getLogonName ()
| Returns the current user's name, if available.
static String | getFullUserName ()
| Returns the current user's full name, if available.
static String | getComputerName ()
| Returns the host-name of the computer.
static String | getUserLanguage ()
| Returns the language of the user's locale.
static String | getUserRegion ()
| Returns the region of the user's locale.
static String | getDisplayLanguage ()
| Returns the user's display language.
static String | getDeviceDescription ()
| This will attempt to return some kind of string describing the device.
static String | getDeviceManufacturer ()
| This will attempt to return the manufacturer of the device.
static StringArray | getDeviceIdentifiers ()
| This method calculates some IDs to uniquely identify the device.
static String | getUniqueDeviceID ()
| This method returns a machine unique ID unaffected by storage or peripheral changes.
static StringArray | getMachineIdentifiers (MachineIdFlags flags)
| Returns a list of strings that can be used to uniquely identify a machine.
static int | getNumCpus () noexcept
| Returns the number of logical CPU cores.
static int | getNumPhysicalCpus () noexcept
| Returns the number of physical CPU cores.
static int | getCpuSpeedInMegahertz ()
| Returns the approximate CPU speed.
static String | getCpuVendor ()
| Returns a string to indicate the CPU vendor.
static String | getCpuModel ()
| Attempts to return a string describing the CPU model.
static bool | hasMMX () noexcept
| Returns true if Intel MMX instructions are available.
static bool | has3DNow () noexcept
| Returns true if AMD 3DNOW instructions are available.
static bool | hasFMA3 () noexcept
| Returns true if AMD FMA3 instructions are available.
static bool | hasFMA4 () noexcept
| Returns true if AMD FMA4 instructions are available.
static bool | hasSSE () noexcept
| Returns true if Intel SSE instructions are available.
static bool | hasSSE2 () noexcept
| Returns true if Intel SSE2 instructions are available.
static bool | hasSSE3 () noexcept
| Returns true if Intel SSE3 instructions are available.
static bool | hasSSSE3 () noexcept
| Returns true if Intel SSSE3 instructions are available.
static bool | hasSSE41 () noexcept
| Returns true if Intel SSE4.1 instructions are available.
static bool | hasSSE42 () noexcept
| Returns true if Intel SSE4.2 instructions are available.
static bool | hasAVX () noexcept
| Returns true if Intel AVX instructions are available.
static bool | hasAVX2 () noexcept
| Returns true if Intel AVX2 instructions are available.
static bool | hasAVX512F () noexcept
| Returns true if Intel AVX-512 Foundation instructions are available.
static bool | hasAVX512BW () noexcept
| Returns true if Intel AVX-512 Byte and Word instructions are available.
static bool | hasAVX512CD () noexcept
| Returns true if Intel AVX-512 Conflict Detection instructions are available.
static bool | hasAVX512DQ () noexcept
| Returns true if Intel AVX-512 Doubleword and Quadword instructions are available.
static bool | hasAVX512ER () noexcept
| Returns true if Intel AVX-512 Exponential and Reciprocal instructions are available.
static bool | hasAVX512IFMA () noexcept
| Returns true if Intel AVX-512 Integer Fused Multiply-Add instructions are available.
static bool | hasAVX512PF () noexcept
| Returns true if Intel AVX-512 Prefetch instructions are available.
static bool | hasAVX512VBMI () noexcept
| Returns true if Intel AVX-512 Vector Bit Manipulation instructions are available.
static bool | hasAVX512VL () noexcept
| Returns true if Intel AVX-512 Vector Length instructions are available.
static bool | hasAVX512VPOPCNTDQ () noexcept
| Returns true if Intel AVX-512 Vector Population Count Double and Quad-word instructions are available.
static bool | hasNeon () noexcept
| Returns true if ARM NEON instructions are available.
static int | getMemorySizeInMegabytes ()
| Finds out how much RAM is in the machine.
static int | getPageSize ()
| Returns the system page-size.
static String | getStackBacktrace ()
| Returns a backtrace of the current call-stack.
static void | setApplicationCrashHandler (CrashHandlerFunction)
| Sets up a global callback function that will be called if the application executes some kind of illegal instruction.
static bool | isRunningInAppExtensionSandbox () noexcept
| Returns true if this code is running inside an app extension sandbox.
static bool | isAppSandboxEnabled ()

## Member Typedef Documentation

## CrashHandlerFunction

using juce::SystemStats::CrashHandlerFunction = void (*) (void*)

A function type for use in setApplicationCrashHandler().

When called, its void* argument will contain platform-specific data about the crash.

## Member Enums

## OperatingSystemType

enum juce::SystemStats::OperatingSystemType

The set of possible results of the getOperatingSystemType() method.

Enumerator
UnknownOS |
MacOSX | To test whether any version of OSX is running, you can use the expression ((getOperatingSystemType() & MacOSX) != 0).
Windows | To test whether any version of Windows is running, you can use the expression ((getOperatingSystemType() & Windows) != 0).
Linux |
Android |
iOS |
WASM |
MacOSX_10_7 |
MacOSX_10_8 |
MacOSX_10_9 |
MacOSX_10_10 |
MacOSX_10_11 |
MacOSX_10_12 |
MacOSX_10_13 |
MacOSX_10_14 |
MacOSX_10_15 |
MacOS_11 |
MacOS_12 |
MacOS_13 |
MacOS_14 |
MacOS_15 |
MacOS_26 |
Win2000 |
WinXP |
WinVista |
Windows7 |
Windows8_0 |
Windows8_1 |
Windows10 |
Windows11 |

## MachineIdFlags

enum class juce::SystemStats::MachineIdFlags

strong

Kinds of identifier that are passed to getMachineIdentifiers().

Enumerator
macAddresses | All Mac addresses of the machine.
fileSystemId | The filesystem id of the user's home directory (or system directory on Windows).
legacyUniqueId | Only implemented on Windows. A hash of the full smbios table, may be unstable on certain machines.
uniqueId | The most stable kind of machine identifier. A good default to use.

## Member Functions

## getJUCEVersion()

String juce::SystemStats::getJUCEVersion | ( |  | ) |

static

Returns the current version of JUCE, See also the JUCE_VERSION, JUCE_MAJOR_VERSION and JUCE_MINOR_VERSION macros.

## getOperatingSystemType()

OperatingSystemType juce::SystemStats::getOperatingSystemType | ( |  | ) |

static

Returns the type of operating system we're running on.

Returns
  one of the values from the OperatingSystemType enum.

See also
  getOperatingSystemName

## getOperatingSystemName()

String juce::SystemStats::getOperatingSystemName | ( |  | ) |

static

Returns the name of the type of operating system we're running on.

Returns
  a string describing the OS type.

See also
  getOperatingSystemType

## isOperatingSystem64Bit()

bool juce::SystemStats::isOperatingSystem64Bit | ( |  | ) |

static

Returns true if the OS is 64-bit, or false for a 32-bit OS.

## getEnvironmentVariable()

String juce::SystemStats::getEnvironmentVariable | ( | const String & | name,
|  | const String & | defaultValue )

static

Returns an environment variable.

If the named value isn't set, this will return the defaultValue string instead.

References name.

## getLogonName()

String juce::SystemStats::getLogonName | ( |  | ) |

static

Returns the current user's name, if available.

See also
  getFullUserName()

## getFullUserName()

String juce::SystemStats::getFullUserName | ( |  | ) |

static

Returns the current user's full name, if available.

On some OSes, this may just return the same value as getLogonName().

See also
  getLogonName()

## getComputerName()

String juce::SystemStats::getComputerName | ( |  | ) |

static

Returns the host-name of the computer.

## getUserLanguage()

String juce::SystemStats::getUserLanguage | ( |  | ) |

static

Returns the language of the user's locale.

The return value is a 2 or 3 letter language code (ISO 639-1 or ISO 639-2)

## getUserRegion()

String juce::SystemStats::getUserRegion | ( |  | ) |

static

Returns the region of the user's locale.

The return value is a 2 letter country code (ISO 3166-1 alpha-2).

## getDisplayLanguage()

String juce::SystemStats::getDisplayLanguage | ( |  | ) |

static

Returns the user's display language.

The return value is a 2 or 3 letter language code (ISO 639-1 or ISO 639-2). Note that depending on the OS and region, this may also be followed by a dash and a sub-region code, e.g "en-GB"

## getDeviceDescription()

String juce::SystemStats::getDeviceDescription | ( |  | ) |

static

This will attempt to return some kind of string describing the device.

If no description is available, it'll just return an empty string. You may want to use this for things like determining the type of phone/iPad, etc.

## getDeviceManufacturer()

String juce::SystemStats::getDeviceManufacturer | ( |  | ) |

static

This will attempt to return the manufacturer of the device.

If no description is available, it'll just return an empty string.

## getDeviceIdentifiers()

StringArray juce::SystemStats::getDeviceIdentifiers | ( |  | ) |

static

This method calculates some IDs to uniquely identify the device.

The first choice for an ID is a filesystem ID for the user's home folder or windows directory. If that fails then this function returns the MAC addresses.

## getUniqueDeviceID()

String juce::SystemStats::getUniqueDeviceID | ( |  | ) |

static

This method returns a machine unique ID unaffected by storage or peripheral changes.

This ID will be invalidated by changes to the motherboard and CPU on non-mobile platforms, or performing a system restore on an Android device.

There are some extra caveats on iOS: The returned ID is unique to the vendor part of your 'Bundle Identifier' and is stable for all associated apps. The key is invalidated once all associated apps are uninstalled. This function can return an empty string under certain conditions, for example, If the device has not been unlocked since a restart.

## getMachineIdentifiers()

StringArray juce::SystemStats::getMachineIdentifiers | ( | MachineIdFlags | flags | ) |

static

Returns a list of strings that can be used to uniquely identify a machine.

To get multiple kinds of identifier at once, you can combine flags using bitwise-or, e.g. uniqueId | legacyUniqueId.

If a particular kind of identifier isn't available, it will be omitted from the StringArray of results, so passing uniqueId | legacyUniqueId may return 0, 1, or 2 results, depending on the platform and whether any errors are encountered.

If you've previously generated a machine ID and just want to check it against all possible identifiers, you can enable all of the flags and check whether the stored identifier matches any of the results.

## getNumCpus()

int juce::SystemStats::getNumCpus | ( |  | ) |

static noexcept

Returns the number of logical CPU cores.

## getNumPhysicalCpus()

int juce::SystemStats::getNumPhysicalCpus | ( |  | ) |

static noexcept

Returns the number of physical CPU cores.

References getNumPhysicalCpus().

Referenced by getNumPhysicalCpus().

## getCpuSpeedInMegahertz()

int juce::SystemStats::getCpuSpeedInMegahertz | ( |  | ) |

static

Returns the approximate CPU speed.

Returns
  the speed in megahertz, e.g. 1500, 2500, 32000 (depending on what year you're reading this...)

References getCpuSpeedInMegahertz().

Referenced by getCpuSpeedInMegahertz(), and isAppSandboxEnabled().

## getCpuVendor()

String juce::SystemStats::getCpuVendor | ( |  | ) |

static

Returns a string to indicate the CPU vendor.

Might not be known on some systems.

References getCpuVendor().

Referenced by getCpuVendor().

## getCpuModel()

String juce::SystemStats::getCpuModel | ( |  | ) |

static

Attempts to return a string describing the CPU model.

May not be available on some systems.

References getCpuModel().

Referenced by getCpuModel().

## hasMMX()

bool juce::SystemStats::hasMMX | ( |  | ) |

static noexcept

Returns true if Intel MMX instructions are available.

References hasMMX().

Referenced by hasMMX().

## has3DNow()

bool juce::SystemStats::has3DNow | ( |  | ) |

static noexcept

Returns true if AMD 3DNOW instructions are available.

References has3DNow().

Referenced by has3DNow().

## hasFMA3()

bool juce::SystemStats::hasFMA3 | ( |  | ) |

static noexcept

Returns true if AMD FMA3 instructions are available.

References hasFMA3().

Referenced by hasFMA3().

## hasFMA4()

bool juce::SystemStats::hasFMA4 | ( |  | ) |

static noexcept

Returns true if AMD FMA4 instructions are available.

References hasFMA4().

Referenced by hasFMA4().

## hasSSE()

bool juce::SystemStats::hasSSE | ( |  | ) |

static noexcept

Returns true if Intel SSE instructions are available.

References hasSSE().

Referenced by hasSSE().

## hasSSE2()

bool juce::SystemStats::hasSSE2 | ( |  | ) |

static noexcept

Returns true if Intel SSE2 instructions are available.

References hasSSE2().

Referenced by hasSSE2().

## hasSSE3()

bool juce::SystemStats::hasSSE3 | ( |  | ) |

static noexcept

Returns true if Intel SSE3 instructions are available.

References hasSSE3().

Referenced by hasSSE3().

## hasSSSE3()

bool juce::SystemStats::hasSSSE3 | ( |  | ) |

static noexcept

Returns true if Intel SSSE3 instructions are available.

References hasSSSE3().

Referenced by hasSSSE3().

## hasSSE41()

bool juce::SystemStats::hasSSE41 | ( |  | ) |

static noexcept

Returns true if Intel SSE4.1 instructions are available.

References hasSSE41().

Referenced by hasSSE41().

## hasSSE42()

bool juce::SystemStats::hasSSE42 | ( |  | ) |

static noexcept

Returns true if Intel SSE4.2 instructions are available.

References hasSSE42().

Referenced by hasSSE42().

## hasAVX()

bool juce::SystemStats::hasAVX | ( |  | ) |

static noexcept

Returns true if Intel AVX instructions are available.

References hasAVX().

Referenced by hasAVX().

## hasAVX2()

bool juce::SystemStats::hasAVX2 | ( |  | ) |

static noexcept

Returns true if Intel AVX2 instructions are available.

References hasAVX2().

Referenced by hasAVX2().

## hasAVX512F()

bool juce::SystemStats::hasAVX512F | ( |  | ) |

static noexcept

Returns true if Intel AVX-512 Foundation instructions are available.

References hasAVX512F().

Referenced by hasAVX512F().

## hasAVX512BW()

bool juce::SystemStats::hasAVX512BW | ( |  | ) |

static noexcept

Returns true if Intel AVX-512 Byte and Word instructions are available.

References hasAVX512BW().

Referenced by hasAVX512BW().

## hasAVX512CD()

bool juce::SystemStats::hasAVX512CD | ( |  | ) |

static noexcept

Returns true if Intel AVX-512 Conflict Detection instructions are available.

References hasAVX512CD().

Referenced by hasAVX512CD().

## hasAVX512DQ()

bool juce::SystemStats::hasAVX512DQ | ( |  | ) |

static noexcept

Returns true if Intel AVX-512 Doubleword and Quadword instructions are available.

References hasAVX512DQ().

Referenced by hasAVX512DQ().

## hasAVX512ER()

bool juce::SystemStats::hasAVX512ER | ( |  | ) |

static noexcept

Returns true if Intel AVX-512 Exponential and Reciprocal instructions are available.

References hasAVX512ER().

Referenced by hasAVX512ER().

## hasAVX512IFMA()

bool juce::SystemStats::hasAVX512IFMA | ( |  | ) |

static noexcept

Returns true if Intel AVX-512 Integer Fused Multiply-Add instructions are available.

References hasAVX512IFMA().

Referenced by hasAVX512IFMA().

## hasAVX512PF()

bool juce::SystemStats::hasAVX512PF | ( |  | ) |

static noexcept

Returns true if Intel AVX-512 Prefetch instructions are available.

References hasAVX512PF().

Referenced by hasAVX512PF().

## hasAVX512VBMI()

bool juce::SystemStats::hasAVX512VBMI | ( |  | ) |

static noexcept

Returns true if Intel AVX-512 Vector Bit Manipulation instructions are available.

References hasAVX512VBMI().

Referenced by hasAVX512VBMI().

## hasAVX512VL()

bool juce::SystemStats::hasAVX512VL | ( |  | ) |

static noexcept

Returns true if Intel AVX-512 Vector Length instructions are available.

References hasAVX512VL().

Referenced by hasAVX512VL().

## hasAVX512VPOPCNTDQ()

bool juce::SystemStats::hasAVX512VPOPCNTDQ | ( |  | ) |

static noexcept

Returns true if Intel AVX-512 Vector Population Count Double and Quad-word instructions are available.

References hasAVX512VPOPCNTDQ().

Referenced by hasAVX512VPOPCNTDQ().

## hasNeon()

bool juce::SystemStats::hasNeon | ( |  | ) |

static noexcept

Returns true if ARM NEON instructions are available.

References hasNeon().

Referenced by hasNeon().

## getMemorySizeInMegabytes()

int juce::SystemStats::getMemorySizeInMegabytes | ( |  | ) |

static

Finds out how much RAM is in the machine.

Returns
  the approximate number of megabytes of memory, or zero if something goes wrong when finding out.

References getMemorySizeInMegabytes().

Referenced by getMemorySizeInMegabytes().

## getPageSize()

int juce::SystemStats::getPageSize | ( |  | ) |

static

Returns the system page-size.

This is only used by programmers with beards.

References getPageSize().

Referenced by getPageSize().

## getStackBacktrace()

String juce::SystemStats::getStackBacktrace | ( |  | ) |

static

Returns a backtrace of the current call-stack.

The usefulness of the result will depend on the level of debug symbols that are available in the executable.

References getStackBacktrace().

Referenced by getStackBacktrace(), juce::HeavyweightLeakedObjectDetector< OwnerClass >::HeavyweightLeakedObjectDetector(), and juce::HeavyweightLeakedObjectDetector< OwnerClass >::HeavyweightLeakedObjectDetector().

## setApplicationCrashHandler()

void juce::SystemStats::setApplicationCrashHandler | ( | CrashHandlerFunction |  | ) |

static

Sets up a global callback function that will be called if the application executes some kind of illegal instruction.

You may want to call getStackBacktrace() in your handler function, to find out where the problem happened and log it, etc.

References setApplicationCrashHandler().

Referenced by setApplicationCrashHandler().

## isRunningInAppExtensionSandbox()

bool juce::SystemStats::isRunningInAppExtensionSandbox | ( |  | ) |

static noexcept

Returns true if this code is running inside an app extension sandbox.

This function will always return false on windows, linux and android.

References isRunningInAppExtensionSandbox().

Referenced by isRunningInAppExtensionSandbox().

## isAppSandboxEnabled()

bool juce::SystemStats::isAppSandboxEnabled | ( |  | ) |

static

References getCpuSpeedInMegahertz().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited