OpenShot Library | OpenShotAudio 0.2.2
juce_SystemStats.h
1
2/** @weakgroup juce_core-system
3 * @{
4 */
5/*
6 ==============================================================================
7
8 This file is part of the JUCE library.
9 Copyright (c) 2017 - ROLI Ltd.
10
11 JUCE is an open source library subject to commercial or open-source
12 licensing.
13
14 The code included in this file is provided under the terms of the ISC license
15 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16 To use, copy, modify, and/or distribute this software for any purpose with or
17 without fee is hereby granted provided that the above copyright notice and
18 this permission notice appear in all copies.
19
20 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22 DISCLAIMED.
23
24 ==============================================================================
25*/
26
27namespace juce
28{
29
30//==============================================================================
31/**
32 Contains methods for finding out about the current hardware and OS configuration.
33
34 @tags{Core}
35*/
37{
38public:
39 //==============================================================================
40 /** Returns the current version of JUCE,
41 See also the JUCE_VERSION, JUCE_MAJOR_VERSION and JUCE_MINOR_VERSION macros.
42 */
43 static String getJUCEVersion();
44
45 //==============================================================================
46 /** The set of possible results of the getOperatingSystemType() method. */
48 {
49 UnknownOS = 0,
50
51 MacOSX = 0x0100, /**< To test whether any version of OSX is running,
52 you can use the expression ((getOperatingSystemType() & MacOSX) != 0). */
53 Windows = 0x0200, /**< To test whether any version of Windows is running,
54 you can use the expression ((getOperatingSystemType() & Windows) != 0). */
55 Linux = 0x0400,
56 Android = 0x0800,
57 iOS = 0x1000,
58
59 MacOSX_10_4 = MacOSX | 4,
60 MacOSX_10_5 = MacOSX | 5,
61 MacOSX_10_6 = MacOSX | 6,
62 MacOSX_10_7 = MacOSX | 7,
63 MacOSX_10_8 = MacOSX | 8,
64 MacOSX_10_9 = MacOSX | 9,
65 MacOSX_10_10 = MacOSX | 10,
66 MacOSX_10_11 = MacOSX | 11,
67 MacOSX_10_12 = MacOSX | 12,
68 MacOSX_10_13 = MacOSX | 13,
69 MacOSX_10_14 = MacOSX | 14,
70
71 Win2000 = Windows | 1,
72 WinXP = Windows | 2,
73 WinVista = Windows | 3,
74 Windows7 = Windows | 4,
75 Windows8_0 = Windows | 5,
76 Windows8_1 = Windows | 6,
77 Windows10 = Windows | 7
78 };
79
80 /** Returns the type of operating system we're running on.
81
82 @returns one of the values from the OperatingSystemType enum.
83 @see getOperatingSystemName
84 */
86
87 /** Returns the name of the type of operating system we're running on.
88
89 @returns a string describing the OS type.
90 @see getOperatingSystemType
91 */
93
94 /** Returns true if the OS is 64-bit, or false for a 32-bit OS. */
96
97 /** Returns an environment variable.
98 If the named value isn't set, this will return the defaultValue string instead.
99 */
100 static String getEnvironmentVariable (const String& name, const String& defaultValue);
101
102 //==============================================================================
103 /** Returns the current user's name, if available.
104 @see getFullUserName()
105 */
107
108 /** Returns the current user's full name, if available.
109 On some OSes, this may just return the same value as getLogonName().
110 @see getLogonName()
111 */
113
114 /** Returns the host-name of the computer. */
116
117 /** Returns the language of the user's locale.
118 The return value is a 2 or 3 letter language code (ISO 639-1 or ISO 639-2)
119 */
121
122 /** Returns the region of the user's locale.
123 The return value is a 2 letter country code (ISO 3166-1 alpha-2).
124 */
126
127 /** Returns the user's display language.
128 The return value is a 2 or 3 letter language code (ISO 639-1 or ISO 639-2).
129 Note that depending on the OS and region, this may also be followed by a dash
130 and a sub-region code, e.g "en-GB"
131 */
133
134 /** This will attempt to return some kind of string describing the device.
135 If no description is available, it'll just return an empty string. You may
136 want to use this for things like determining the type of phone/iPad, etc.
137 */
139
140 /** This will attempt to return the manufacturer of the device.
141 If no description is available, it'll just return an empty string.
142 */
144
145 /** This method calculates some IDs to uniquely identify the device.
146
147 The first choice for an ID is a filesystem ID for the user's home folder or
148 windows directory. If that fails then this function returns the MAC addresses.
149 */
150 static StringArray getDeviceIdentifiers();
151
152 //==============================================================================
153 // CPU and memory information..
154
155 /** Returns the number of logical CPU cores. */
156 static int getNumCpus() noexcept;
157
158 /** Returns the number of physical CPU cores. */
159 static int getNumPhysicalCpus() noexcept;
160
161 /** Returns the approximate CPU speed.
162 @returns the speed in megahertz, e.g. 1500, 2500, 32000 (depending on
163 what year you're reading this...)
164 */
165 static int getCpuSpeedInMegahertz();
166
167 /** Returns a string to indicate the CPU vendor.
168 Might not be known on some systems.
169 */
170 static String getCpuVendor();
171
172 /** Attempts to return a string describing the CPU model.
173 May not be available on some systems.
174 */
175 static String getCpuModel();
176
177 static bool hasMMX() noexcept; /**< Returns true if Intel MMX instructions are available. */
178 static bool has3DNow() noexcept; /**< Returns true if AMD 3DNOW instructions are available. */
179 static bool hasFMA3() noexcept; /**< Returns true if AMD FMA3 instructions are available. */
180 static bool hasFMA4() noexcept; /**< Returns true if AMD FMA4 instructions are available. */
181 static bool hasSSE() noexcept; /**< Returns true if Intel SSE instructions are available. */
182 static bool hasSSE2() noexcept; /**< Returns true if Intel SSE2 instructions are available. */
183 static bool hasSSE3() noexcept; /**< Returns true if Intel SSE3 instructions are available. */
184 static bool hasSSSE3() noexcept; /**< Returns true if Intel SSSE3 instructions are available. */
185 static bool hasSSE41() noexcept; /**< Returns true if Intel SSE4.1 instructions are available. */
186 static bool hasSSE42() noexcept; /**< Returns true if Intel SSE4.2 instructions are available. */
187 static bool hasAVX() noexcept; /**< Returns true if Intel AVX instructions are available. */
188 static bool hasAVX2() noexcept; /**< Returns true if Intel AVX2 instructions are available. */
189 static bool hasAVX512F() noexcept; /**< Returns true if Intel AVX-512 Foundation instructions are available. */
190 static bool hasAVX512BW() noexcept; /**< Returns true if Intel AVX-512 Byte and Word instructions are available. */
191 static bool hasAVX512CD() noexcept; /**< Returns true if Intel AVX-512 Conflict Detection instructions are available. */
192 static bool hasAVX512DQ() noexcept; /**< Returns true if Intel AVX-512 Doubleword and Quadword instructions are available. */
193 static bool hasAVX512ER() noexcept; /**< Returns true if Intel AVX-512 Exponential and Reciprocal instructions are available. */
194 static bool hasAVX512IFMA() noexcept; /**< Returns true if Intel AVX-512 Integer Fused Multiply-Add instructions are available. */
195 static bool hasAVX512PF() noexcept; /**< Returns true if Intel AVX-512 Prefetch instructions are available. */
196 static bool hasAVX512VBMI() noexcept; /**< Returns true if Intel AVX-512 Vector Bit Manipulation instructions are available. */
197 static bool hasAVX512VL() noexcept; /**< Returns true if Intel AVX-512 Vector Length instructions are available. */
198 static bool hasAVX512VPOPCNTDQ() noexcept; /**< Returns true if Intel AVX-512 Vector Population Count Double and Quad-word instructions are available. */
199 static bool hasNeon() noexcept; /**< Returns true if ARM NEON instructions are available. */
200
201 //==============================================================================
202 /** Finds out how much RAM is in the machine.
203 @returns the approximate number of megabytes of memory, or zero if
204 something goes wrong when finding out.
205 */
206 static int getMemorySizeInMegabytes();
207
208 /** Returns the system page-size.
209 This is only used by programmers with beards.
210 */
211 static int getPageSize();
212
213 //==============================================================================
214 /** Returns a backtrace of the current call-stack.
215 The usefulness of the result will depend on the level of debug symbols
216 that are available in the executable.
217 */
218 static String getStackBacktrace();
219
220 /** A function type for use in setApplicationCrashHandler().
221 When called, its void* argument will contain platform-specific data about the crash.
222 */
223 using CrashHandlerFunction = void(*)(void*);
224
225 /** Sets up a global callback function that will be called if the application
226 executes some kind of illegal instruction.
227
228 You may want to call getStackBacktrace() in your handler function, to find out
229 where the problem happened and log it, etc.
230 */
231 static void setApplicationCrashHandler (CrashHandlerFunction);
232
233 /** Returns true if this code is running inside an app extension sandbox.
234 This function will always return false on windows, linux and android.
235 */
236 static bool isRunningInAppExtensionSandbox() noexcept;
237
238
239 //==============================================================================
240 // This method was spelt wrong! Please change your code to use getCpuSpeedInMegahertz() instead
241 JUCE_DEPRECATED_WITH_BODY (static int getCpuSpeedInMegaherz(), { return getCpuSpeedInMegahertz(); })
242
243private:
244 SystemStats() = delete; // uses only static methods
245 JUCE_DECLARE_NON_COPYABLE (SystemStats)
246};
247
248} // namespace juce
249
250/** @}*/
A special array for holding a list of strings.
The JUCE String class!
Definition: juce_String.h:43
Contains methods for finding out about the current hardware and OS configuration.
static String getOperatingSystemName()
Returns the name of the type of operating system we're running on.
void(*)(void *) CrashHandlerFunction
A function type for use in setApplicationCrashHandler().
static String getUserRegion()
Returns the region of the user's locale.
static String getFullUserName()
Returns the current user's full name, if available.
static String getLogonName()
Returns the current user's name, if available.
static OperatingSystemType getOperatingSystemType()
Returns the type of operating system we're running on.
static String getDeviceManufacturer()
This will attempt to return the manufacturer of the device.
static bool isOperatingSystem64Bit()
Returns true if the OS is 64-bit, or false for a 32-bit OS.
static String getDisplayLanguage()
Returns the user's display language.
static String getEnvironmentVariable(const String &name, const String &defaultValue)
Returns an environment variable.
OperatingSystemType
The set of possible results of the getOperatingSystemType() method.
static String getComputerName()
Returns the host-name of the computer.
static String getDeviceDescription()
This will attempt to return some kind of string describing the device.
static String getUserLanguage()
Returns the language of the user's locale.
#define JUCE_API
This macro is added to all JUCE public class declarations.