OpenShot Library | libopenshot-audio 0.2.0
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
69 Win2000 = Windows | 1,
70 WinXP = Windows | 2,
71 WinVista = Windows | 3,
72 Windows7 = Windows | 4,
73 Windows8_0 = Windows | 5,
74 Windows8_1 = Windows | 6,
75 Windows10 = Windows | 7
76 };
77
78 /** Returns the type of operating system we're running on.
79
80 @returns one of the values from the OperatingSystemType enum.
81 @see getOperatingSystemName
82 */
84
85 /** Returns the name of the type of operating system we're running on.
86
87 @returns a string describing the OS type.
88 @see getOperatingSystemType
89 */
91
92 /** Returns true if the OS is 64-bit, or false for a 32-bit OS. */
94
95 /** Returns an environment variable.
96 If the named value isn't set, this will return the defaultValue string instead.
97 */
98 static String getEnvironmentVariable (const String& name, const String& defaultValue);
99
100 //==============================================================================
101 /** Returns the current user's name, if available.
102 @see getFullUserName()
103 */
105
106 /** Returns the current user's full name, if available.
107 On some OSes, this may just return the same value as getLogonName().
108 @see getLogonName()
109 */
111
112 /** Returns the host-name of the computer. */
114
115 /** Returns the language of the user's locale.
116 The return value is a 2 or 3 letter language code (ISO 639-1 or ISO 639-2)
117 */
119
120 /** Returns the region of the user's locale.
121 The return value is a 2 letter country code (ISO 3166-1 alpha-2).
122 */
124
125 /** Returns the user's display language.
126 The return value is a 2 or 3 letter language code (ISO 639-1 or ISO 639-2).
127 Note that depending on the OS and region, this may also be followed by a dash
128 and a sub-region code, e.g "en-GB"
129 */
131
132 /** This will attempt to return some kind of string describing the device.
133 If no description is available, it'll just return an empty string. You may
134 want to use this for things like determining the type of phone/iPad, etc.
135 */
137
138 /** This will attempt to return the manufacturer of the device.
139 If no description is available, it'll just return an empty string.
140 */
142
143 /** This method calculates some IDs to uniquely identify the device.
144
145 The first choice for an ID is a filesystem ID for the user's home folder or
146 windows directory. If that fails then this function returns the MAC addresses.
147 */
148 static StringArray getDeviceIdentifiers();
149
150 //==============================================================================
151 // CPU and memory information..
152
153 /** Returns the number of logical CPU cores. */
154 static int getNumCpus() noexcept;
155
156 /** Returns the number of physical CPU cores. */
157 static int getNumPhysicalCpus() noexcept;
158
159 /** Returns the approximate CPU speed.
160 @returns the speed in megahertz, e.g. 1500, 2500, 32000 (depending on
161 what year you're reading this...)
162 */
163 static int getCpuSpeedInMegahertz();
164
165 /** Returns a string to indicate the CPU vendor.
166 Might not be known on some systems.
167 */
168 static String getCpuVendor();
169
170 /** Attempts to return a string describing the CPU model.
171 May not be available on some systems.
172 */
173 static String getCpuModel();
174
175 static bool hasMMX() noexcept; /**< Returns true if Intel MMX instructions are available. */
176 static bool has3DNow() noexcept; /**< Returns true if AMD 3DNOW instructions are available. */
177 static bool hasSSE() noexcept; /**< Returns true if Intel SSE instructions are available. */
178 static bool hasSSE2() noexcept; /**< Returns true if Intel SSE2 instructions are available. */
179 static bool hasSSE3() noexcept; /**< Returns true if Intel SSE3 instructions are available. */
180 static bool hasSSSE3() noexcept; /**< Returns true if Intel SSSE3 instructions are available. */
181 static bool hasSSE41() noexcept; /**< Returns true if Intel SSE4.1 instructions are available. */
182 static bool hasSSE42() noexcept; /**< Returns true if Intel SSE4.2 instructions are available. */
183 static bool hasAVX() noexcept; /**< Returns true if Intel AVX instructions are available. */
184 static bool hasAVX2() noexcept; /**< Returns true if Intel AVX2 instructions are available. */
185 static bool hasAVX512F() noexcept; /**< Returns true if Intel AVX-512 Foundation instructions are available. */
186 static bool hasAVX512BW() noexcept; /**< Returns true if Intel AVX-512 Byte and Word instructions are available. */
187 static bool hasAVX512CD() noexcept; /**< Returns true if Intel AVX-512 Conflict Detection instructions are available. */
188 static bool hasAVX512DQ() noexcept; /**< Returns true if Intel AVX-512 Doubleword and Quadword instructions are available. */
189 static bool hasAVX512ER() noexcept; /**< Returns true if Intel AVX-512 Exponential and Reciprocal instructions are available. */
190 static bool hasAVX512IFMA() noexcept; /**< Returns true if Intel AVX-512 Integer Fused Multiply-Add instructions are available. */
191 static bool hasAVX512PF() noexcept; /**< Returns true if Intel AVX-512 Prefetch instructions are available. */
192 static bool hasAVX512VBMI() noexcept; /**< Returns true if Intel AVX-512 Vector Bit Manipulation instructions are available. */
193 static bool hasAVX512VL() noexcept; /**< Returns true if Intel AVX-512 Vector Length instructions are available. */
194 static bool hasAVX512VPOPCNTDQ() noexcept; /**< Returns true if Intel AVX-512 Vector Population Count Double and Quad-word instructions are available. */
195 static bool hasNeon() noexcept; /**< Returns true if ARM NEON instructions are available. */
196
197 //==============================================================================
198 /** Finds out how much RAM is in the machine.
199 @returns the approximate number of megabytes of memory, or zero if
200 something goes wrong when finding out.
201 */
202 static int getMemorySizeInMegabytes();
203
204 /** Returns the system page-size.
205 This is only used by programmers with beards.
206 */
207 static int getPageSize();
208
209 //==============================================================================
210 /** Returns a backtrace of the current call-stack.
211 The usefulness of the result will depend on the level of debug symbols
212 that are available in the executable.
213 */
214 static String getStackBacktrace();
215
216 /** A function type for use in setApplicationCrashHandler().
217 When called, its void* argument will contain platform-specific data about the crash.
218 */
219 using CrashHandlerFunction = void(*)(void*);
220
221 /** Sets up a global callback function that will be called if the application
222 executes some kind of illegal instruction.
223
224 You may want to call getStackBacktrace() in your handler function, to find out
225 where the problem happened and log it, etc.
226 */
227 static void setApplicationCrashHandler (CrashHandlerFunction);
228
229 /** Returns true if this code is running inside an app extension sandbox.
230 This function will always return false on windows, linux and android.
231 */
232 static bool isRunningInAppExtensionSandbox() noexcept;
233
234
235 //==============================================================================
236 // This method was spelt wrong! Please change your code to use getCpuSpeedInMegahertz() instead
237 JUCE_DEPRECATED_WITH_BODY (static int getCpuSpeedInMegaherz(), { return getCpuSpeedInMegahertz(); })
238
239private:
240 SystemStats() = delete; // uses only static methods
241 JUCE_DECLARE_NON_COPYABLE (SystemStats)
242};
243
244} // namespace juce
245
246/** @}*/
Holds a resizable array of primitive or copy-by-value objects.
Definition juce_Array.h:60
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.