mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-31 03:00:05 +00:00
Add SSE4.1, SSE4.2 and AVX2 system stat flags and fix documentation typo
This commit is contained in:
parent
e5522b78e3
commit
e6b4dcb6a2
6 changed files with 44 additions and 18 deletions
|
|
@ -120,15 +120,20 @@ static String getAllSystemInfo()
|
|||
<< "User language: " << SystemStats::getUserLanguage() << newLine
|
||||
<< "Display language: " << SystemStats::getDisplayLanguage() << newLine
|
||||
<< newLine
|
||||
<< "Number of CPUs: " << SystemStats::getNumCpus() << newLine
|
||||
<< "Memory size: " << SystemStats::getMemorySizeInMegabytes() << " MB" << newLine
|
||||
<< "CPU vendor: " << SystemStats::getCpuVendor() << newLine
|
||||
<< "CPU speed: " << SystemStats::getCpuSpeedInMegaherz() << " MHz" << newLine
|
||||
<< "CPU has MMX: " << (SystemStats::hasMMX() ? "yes" : "no") << newLine
|
||||
<< "CPU has SSE: " << (SystemStats::hasSSE() ? "yes" : "no") << newLine
|
||||
<< "CPU has SSE2: " << (SystemStats::hasSSE2() ? "yes" : "no") << newLine
|
||||
<< "CPU has SSE3: " << (SystemStats::hasSSE3() ? "yes" : "no") << newLine
|
||||
<< "CPU has 3DNOW: " << (SystemStats::has3DNow() ? "yes" : "no") << newLine
|
||||
<< "Number of CPUs: " << SystemStats::getNumCpus() << newLine
|
||||
<< "Memory size: " << SystemStats::getMemorySizeInMegabytes() << " MB" << newLine
|
||||
<< "CPU vendor: " << SystemStats::getCpuVendor() << newLine
|
||||
<< "CPU speed: " << SystemStats::getCpuSpeedInMegaherz() << " MHz" << newLine
|
||||
<< "CPU has MMX: " << (SystemStats::hasMMX() ? "yes" : "no") << newLine
|
||||
<< "CPU has SSE: " << (SystemStats::hasSSE() ? "yes" : "no") << newLine
|
||||
<< "CPU has SSE2: " << (SystemStats::hasSSE2() ? "yes" : "no") << newLine
|
||||
<< "CPU has SSE3: " << (SystemStats::hasSSE3() ? "yes" : "no") << newLine
|
||||
<< "CPU has SSSE3: " << (SystemStats::hasSSSE3() ? "yes" : "no") << newLine
|
||||
<< "CPU has SSE4.1: " << (SystemStats::hasSSE41() ? "yes" : "no") << newLine
|
||||
<< "CPU has SSE4.2: " << (SystemStats::hasSSE42() ? "yes" : "no") << newLine
|
||||
<< "CPU has 3DNOW: " << (SystemStats::has3DNow() ? "yes" : "no") << newLine
|
||||
<< "CPU has AVX: " << (SystemStats::hasAVX() ? "yes" : "no") << newLine
|
||||
<< "CPU has AVX2: " << (SystemStats::hasAVX2() ? "yes" : "no") << newLine
|
||||
<< newLine
|
||||
<< "Current working directory: " << File::getCurrentWorkingDirectory().getFullPathName() << newLine
|
||||
<< "Current application file: " << File::getSpecialLocation (File::currentApplicationFile).getFullPathName() << newLine
|
||||
|
|
|
|||
|
|
@ -156,7 +156,10 @@ void CPUInformation::initialise() noexcept
|
|||
hasSSE3 = flags.contains ("sse3");
|
||||
has3DNow = flags.contains ("3dnow");
|
||||
hasSSSE3 = flags.contains ("ssse3");
|
||||
hasSSE41 = flags.contains ("sse4_1");
|
||||
hasSSE42 = flags.contains ("sse4_2");
|
||||
hasAVX = flags.contains ("avx");
|
||||
hasAVX2 = flags.contains ("avx2");
|
||||
|
||||
numCpus = LinuxStatsHelpers::getCpuInfo ("processor").getIntValue() + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,12 @@ void CPUInformation::initialise() noexcept
|
|||
has3DNow = (b & (1u << 31)) != 0;
|
||||
hasSSE3 = (c & (1u << 0)) != 0;
|
||||
hasSSSE3 = (c & (1u << 9)) != 0;
|
||||
hasSSE41 = (c & (1u << 20)) != 0;
|
||||
hasSSE42 = (c & (1u << 19)) != 0;
|
||||
hasAVX = (c & (1u << 28)) != 0;
|
||||
|
||||
SystemStatsHelpers::doCPUID (a, b, c, d, 7);
|
||||
hasAVX2 = (b & (1u << 5)) != 0;
|
||||
#endif
|
||||
|
||||
numCpus = (int) [[NSProcessInfo processInfo] activeProcessorCount];
|
||||
|
|
|
|||
|
|
@ -107,8 +107,14 @@ void CPUInformation::initialise() noexcept
|
|||
hasSSE3 = (info[2] & (1 << 0)) != 0;
|
||||
hasAVX = (info[2] & (1 << 28)) != 0;
|
||||
hasSSSE3 = (info[2] & (1 << 9)) != 0;
|
||||
hasSSE41 = (info[2] & (1 << 19)) != 0;
|
||||
hasSSE42 = (info[2] & (1 << 20)) != 0;
|
||||
has3DNow = (info[1] & (1 << 31)) != 0;
|
||||
|
||||
callCPUID (info, 7);
|
||||
|
||||
hasAVX2 = (info[1] & (1 << 5)) != 0;
|
||||
|
||||
SYSTEM_INFO systemInfo;
|
||||
GetNativeSystemInfo (&systemInfo);
|
||||
numCpus = (int) systemInfo.dwNumberOfProcessors;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ struct CPUInformation
|
|||
CPUInformation() noexcept
|
||||
: numCpus (0), hasMMX (false), hasSSE (false),
|
||||
hasSSE2 (false), hasSSE3 (false), has3DNow (false),
|
||||
hasSSSE3 (false), hasAVX (false)
|
||||
hasSSSE3 (false), hasSSE41 (false), hasSSE42 (false),
|
||||
hasAVX (false), hasAVX2 (false)
|
||||
{
|
||||
initialise();
|
||||
}
|
||||
|
|
@ -76,7 +77,7 @@ struct CPUInformation
|
|||
void initialise() noexcept;
|
||||
|
||||
int numCpus;
|
||||
bool hasMMX, hasSSE, hasSSE2, hasSSE3, has3DNow, hasSSSE3, hasAVX;
|
||||
bool hasMMX, hasSSE, hasSSE2, hasSSE3, has3DNow, hasSSSE3, hasSSE41, hasSSE42, hasAVX, hasAVX2;
|
||||
};
|
||||
|
||||
static const CPUInformation& getCPUInformation() noexcept
|
||||
|
|
@ -92,7 +93,10 @@ bool SystemStats::hasSSE() noexcept { return getCPUInformation().hasSS
|
|||
bool SystemStats::hasSSE2() noexcept { return getCPUInformation().hasSSE2; }
|
||||
bool SystemStats::hasSSE3() noexcept { return getCPUInformation().hasSSE3; }
|
||||
bool SystemStats::hasSSSE3() noexcept { return getCPUInformation().hasSSSE3; }
|
||||
bool SystemStats::hasSSE41() noexcept { return getCPUInformation().hasSSE41; }
|
||||
bool SystemStats::hasSSE42() noexcept { return getCPUInformation().hasSSE42; }
|
||||
bool SystemStats::hasAVX() noexcept { return getCPUInformation().hasAVX; }
|
||||
bool SystemStats::hasAVX2() noexcept { return getCPUInformation().hasAVX2; }
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -152,13 +152,16 @@ public:
|
|||
*/
|
||||
static String getCpuVendor();
|
||||
|
||||
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 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 SSE2 instructions are available. */
|
||||
static bool hasSSSE3() noexcept; /**< Returns true if Intel SSSE3 instructions are available. */
|
||||
static bool hasAVX() noexcept; /**< Returns true if Intel AVX instructions are available. */
|
||||
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 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. */
|
||||
|
||||
//==============================================================================
|
||||
/** Finds out how much RAM is in the machine.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue