24extern "C" int cobalt_thread_mode();
31static String getCpuInfo (
const char* key)
36static String getLocaleValue (
nl_item key)
90 return getCpuInfo (
"Hardware");
104 auto v = getCpuInfo (
"vendor_id");
107 v = getCpuInfo (
"model name");
130 return getCpuInfo (
"model name");
142 return roundToInt (getCpuInfo (
"cpu MHz").getFloatValue());
154 auto memorySize =
sizeof (memory);
156 return result == 0 ? (
int) (memory / (
int64) 1
e6) : 0;
161 return (
int) (
sysi.totalram *
sysi.mem_unit / (1024 * 1024));
232void CPUInformation::initialise() noexcept
235 #if JUCE_INTEL && ! JUCE_NO_INLINE_ASM
236 SystemStatsHelpers::getCPUInfo (hasMMX,
260 numLogicalCPUs = numPhysicalCPUs = []
269 return result == 0 ?
numCPUs : 1;
272 auto flags = getCpuInfo (
"flags");
274 hasMMX = flags.contains (
"mmx");
275 hasFMA3 = flags.contains (
"fma");
276 hasFMA4 = flags.contains (
"fma4");
277 hasSSE = flags.contains (
"sse");
278 hasSSE2 = flags.contains (
"sse2");
279 hasSSE3 = flags.contains (
"sse3");
280 has3DNow = flags.contains (
"3dnow");
281 hasSSSE3 = flags.contains (
"ssse3");
282 hasSSE41 = flags.contains (
"sse4_1");
283 hasSSE42 = flags.contains (
"sse4_2");
284 hasAVX = flags.contains (
"avx");
285 hasAVX2 = flags.contains (
"avx2");
286 hasAVX512F = flags.contains (
"avx512f");
287 hasAVX512BW = flags.contains (
"avx512bw");
288 hasAVX512CD = flags.contains (
"avx512cd");
289 hasAVX512DQ = flags.contains (
"avx512dq");
290 hasAVX512ER = flags.contains (
"avx512er");
291 hasAVX512IFMA = flags.contains (
"avx512ifma");
292 hasAVX512PF = flags.contains (
"avx512pf");
293 hasAVX512VBMI = flags.contains (
"avx512vbmi");
294 hasAVX512VL = flags.contains (
"avx512vl");
295 hasAVX512VPOPCNTDQ = flags.contains (
"avx512_vpopcntdq");
297 numLogicalCPUs = getCpuInfo (
"processor").
getIntValue() + 1;
300 numPhysicalCPUs = getCpuInfo (
"cpu cores").
getIntValue() * (getCpuInfo (
"physical id").
getIntValue() + 1);
302 if (numPhysicalCPUs <= 0)
303 numPhysicalCPUs = numLogicalCPUs;
311 const auto call = [] (
auto command) ->
String
315 if (
proc.start (command, ChildProcess::wantStdOut))
321 auto data = call (
"cat /sys/class/dmi/id/board_serial");
326 data = call (
"cat /sys/class/dmi/id/bios_date")
327 + call (
"cat /sys/class/dmi/id/bios_release")
328 + call (
"cat /sys/class/dmi/id/bios_vendor")
329 + call (
"cat /sys/class/dmi/id/bios_version");
342 auto start =
cpuData.indexOf (index,
":");
345 return cpuData.substring (start + 1,
end).trim();
351 data += getCpuInfo (
"CPU family:");
352 data += getCpuInfo (
"Model:");
353 data += getCpuInfo (
"Model name:");
354 data += getCpuInfo (
"Vendor ID:");
366uint32 juce_millisecondsSinceStartup() noexcept
384 return (t.tv_sec * (
int64) 1000000) + (t.tv_nsec / 1000);
400 t.tv_sec =
decltype (timeval::tv_sec) (millisSinceEpoch / 1000);
401 t.tv_usec =
decltype (timeval::tv_usec) ((millisSinceEpoch - t.tv_sec * 1000) * 1000);
419 return result == 0 ? ((info.ki_flag &
P_TRACED) != 0) :
false;
Launches and monitors a child process.
String readAllProcessOutput()
Blocks until the process has finished, and then returns its complete output as a string.
static void JUCE_CALLTYPE outputDebugString(const String &text)
Writes a message to the standard error stream.
A class to hold a resizable block of raw data.
int indexOf(StringRef textToLookFor) const noexcept
Searches for a substring within this string.
String upToLastOccurrenceOf(StringRef substringToFind, bool includeSubStringInResult, bool ignoreCase) const
Returns the start of this string, up to the last occurrence of a substring.
static String fromUTF8(const char *utf8buffer, int bufferSizeBytes=-1)
Creates a String from a UTF-8 encoded buffer.
int getIntValue() const noexcept
Reads the value of the string as a decimal number (up to 32 bits in size).
static String getUniqueDeviceID()
This method returns a machine unique ID unaffected by storage or peripheral changes.
static int getPageSize()
Returns the system page-size.
static String getOperatingSystemName()
Returns the name of the type of operating system we're running on.
static String getUserRegion()
Returns the region of the user's locale.
static String getDeviceDescription()
This will attempt to return some kind of string describing the device.
static String getLogonName()
Returns the current user's name, if available.
static String getUserLanguage()
Returns the language of the user's locale.
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.
OperatingSystemType
The set of possible results of the getOperatingSystemType() method.
static String getComputerName()
Returns the host-name of the computer.
static OperatingSystemType getOperatingSystemType()
Returns the type of operating system we're running on.
static String getCpuModel()
Attempts to return a string describing the CPU model.
static int getCpuSpeedInMegahertz()
Returns the approximate CPU speed.
static String getCpuVendor()
Returns a string to indicate the CPU vendor.
static String getFullUserName()
Returns the current user's full name, if available.
static int getMemorySizeInMegabytes()
Finds out how much RAM is in the machine.
static String getDisplayLanguage()
Returns the user's display language.
static double getMillisecondCounterHiRes() noexcept
Returns the number of millisecs since a fixed event (usually system startup).
static int64 getHighResolutionTicksPerSecond() noexcept
Returns the resolution of the high-resolution counter in ticks per second.
bool setSystemTimeToThisTime() const
Tries to set the computer's clock.
static int64 getHighResolutionTicks() noexcept
Returns the current high-resolution counter's tick-count.
bool juce_isRunningUnderDebugger() noexcept
< This macro is added to all JUCE public class declarations.
RangedDirectoryIterator end(const RangedDirectoryIterator &)
Returns a default-constructed sentinel value.
signed int int32
A platform-independent 32-bit signed integer type.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
unsigned int uint32
A platform-independent 32-bit unsigned integer type.
int roundToInt(const FloatType value) noexcept
Fast floating-point-to-integer conversion.
constexpr int numElementsInArray(Type(&)[N]) noexcept
Handy function for getting the number of elements in a simple const C array.
long long int64
A platform-independent 64-bit integer type.