JUCE: SystemStats Class Reference

JUCE

Public Types | Static Public Member Functions | List of all members
SystemStats Class Referencefinal
juce_core » system

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

`#include <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 , 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...
using | CrashHandlerFunction = void(*)(void *)
| A function type for use in setApplicationCrashHandler(). More...

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

## Detailed Description

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

## Member Typedef Documentation

## ◆ CrashHandlerFunction

using 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 Enumeration Documentation

## ◆ OperatingSystemType

enum 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 |
Win2000 |
WinXP |
WinVista |
Windows7 |
Windows8_0 |
Windows8_1 |
Windows10 |
Windows11 |

## Member Function Documentation

## ◆ getJUCEVersion()

static String SystemStats::getJUCEVersion | ( |  | ) |
| static

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

## ◆ getOperatingSystemType()

static OperatingSystemType 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()

static String 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()

static bool SystemStats::isOperatingSystem64Bit | ( |  | ) |
| static

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

## ◆ getEnvironmentVariable()

static String 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.

## ◆ getLogonName()

static String SystemStats::getLogonName | ( |  | ) |
| static

Returns the current user's name, if available.

See also
  getFullUserName()

## ◆ getFullUserName()

static String 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()

static String SystemStats::getComputerName | ( |  | ) |
| static

Returns the host-name of the computer.

## ◆ getUserLanguage()

static String 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()

static String 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()

static String 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()

static String 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()

static String 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()

static StringArray 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.

## ◆ getNumCpus()

static int SystemStats::getNumCpus | ( |  | ) |
| staticnoexcept

Returns the number of logical CPU cores.

## ◆ getNumPhysicalCpus()

static int SystemStats::getNumPhysicalCpus | ( |  | ) |
| staticnoexcept

Returns the number of physical CPU cores.

## ◆ getCpuSpeedInMegahertz()

static int 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...)

## ◆ getCpuVendor()

static String SystemStats::getCpuVendor | ( |  | ) |
| static

Returns a string to indicate the CPU vendor.

Might not be known on some systems.

## ◆ getCpuModel()

static String SystemStats::getCpuModel | ( |  | ) |
| static

Attempts to return a string describing the CPU model.

May not be available on some systems.

## ◆ hasMMX()

static bool SystemStats::hasMMX | ( |  | ) |
| staticnoexcept

Returns true if Intel MMX instructions are available.

## ◆ has3DNow()

static bool SystemStats::has3DNow | ( |  | ) |
| staticnoexcept

Returns true if AMD 3DNOW instructions are available.

## ◆ hasFMA3()

static bool SystemStats::hasFMA3 | ( |  | ) |
| staticnoexcept

Returns true if AMD FMA3 instructions are available.

## ◆ hasFMA4()

static bool SystemStats::hasFMA4 | ( |  | ) |
| staticnoexcept

Returns true if AMD FMA4 instructions are available.

## ◆ hasSSE()

static bool SystemStats::hasSSE | ( |  | ) |
| staticnoexcept

Returns true if Intel SSE instructions are available.

## ◆ hasSSE2()

static bool SystemStats::hasSSE2 | ( |  | ) |
| staticnoexcept

Returns true if Intel SSE2 instructions are available.

## ◆ hasSSE3()

static bool SystemStats::hasSSE3 | ( |  | ) |
| staticnoexcept

Returns true if Intel SSE3 instructions are available.

## ◆ hasSSSE3()

static bool SystemStats::hasSSSE3 | ( |  | ) |
| staticnoexcept

Returns true if Intel SSSE3 instructions are available.

## ◆ hasSSE41()

static bool SystemStats::hasSSE41 | ( |  | ) |
| staticnoexcept

Returns true if Intel SSE4.1 instructions are available.

## ◆ hasSSE42()

static bool SystemStats::hasSSE42 | ( |  | ) |
| staticnoexcept

Returns true if Intel SSE4.2 instructions are available.

## ◆ hasAVX()

static bool SystemStats::hasAVX | ( |  | ) |
| staticnoexcept

Returns true if Intel AVX instructions are available.

## ◆ hasAVX2()

static bool SystemStats::hasAVX2 | ( |  | ) |
| staticnoexcept

Returns true if Intel AVX2 instructions are available.

## ◆ hasAVX512F()

static bool SystemStats::hasAVX512F | ( |  | ) |
| staticnoexcept

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

## ◆ hasAVX512BW()

static bool SystemStats::hasAVX512BW | ( |  | ) |
| staticnoexcept

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

## ◆ hasAVX512CD()

static bool SystemStats::hasAVX512CD | ( |  | ) |
| staticnoexcept

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

## ◆ hasAVX512DQ()

static bool SystemStats::hasAVX512DQ | ( |  | ) |
| staticnoexcept

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

## ◆ hasAVX512ER()

static bool SystemStats::hasAVX512ER | ( |  | ) |
| staticnoexcept

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

## ◆ hasAVX512IFMA()

static bool SystemStats::hasAVX512IFMA | ( |  | ) |
| staticnoexcept

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

## ◆ hasAVX512PF()

static bool SystemStats::hasAVX512PF | ( |  | ) |
| staticnoexcept

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

## ◆ hasAVX512VBMI()

static bool SystemStats::hasAVX512VBMI | ( |  | ) |
| staticnoexcept

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

## ◆ hasAVX512VL()

static bool SystemStats::hasAVX512VL | ( |  | ) |
| staticnoexcept

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

## ◆ hasAVX512VPOPCNTDQ()

static bool SystemStats::hasAVX512VPOPCNTDQ | ( |  | ) |
| staticnoexcept

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

## ◆ hasNeon()

static bool SystemStats::hasNeon | ( |  | ) |
| staticnoexcept

Returns true if ARM NEON instructions are available.

## ◆ getMemorySizeInMegabytes()

static int 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.

## ◆ getPageSize()

static int SystemStats::getPageSize | ( |  | ) |
| static

Returns the system page-size.

This is only used by programmers with beards.

## ◆ getStackBacktrace()

static String 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.

Referenced by HeavyweightLeakedObjectDetector< OwnerClass >::HeavyweightLeakedObjectDetector().

## ◆ setApplicationCrashHandler()

static void 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.

## ◆ isRunningInAppExtensionSandbox()

static bool SystemStats::isRunningInAppExtensionSandbox | ( |  | ) |
| staticnoexcept

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

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

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

- juce_SystemStats.h