mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add tests for SSE3 capability
This commit is contained in:
@@ -21,12 +21,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
const SystemStats::CPUFlags& SystemStats::getCPUFlags()
|
||||
{
|
||||
static CPUFlags cpuFlags;
|
||||
return cpuFlags;
|
||||
}
|
||||
|
||||
String SystemStats::getBeastVersion()
|
||||
{
|
||||
// Some basic tests, to keep an eye on things and make sure these types work ok
|
||||
@@ -62,6 +56,34 @@ String SystemStats::getBeastVersion()
|
||||
static BeastVersionPrinter beastVersionPrinter;
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
struct CPUInformation
|
||||
{
|
||||
CPUInformation() noexcept
|
||||
: numCpus (0), hasMMX (false), hasSSE (false),
|
||||
hasSSE2 (false), hasSSE3 (false), has3DNow (false)
|
||||
{
|
||||
initialise();
|
||||
}
|
||||
|
||||
void initialise() noexcept;
|
||||
|
||||
int numCpus;
|
||||
bool hasMMX, hasSSE, hasSSE2, hasSSE3, has3DNow;
|
||||
};
|
||||
|
||||
static const CPUInformation& getCPUInformation() noexcept
|
||||
{
|
||||
static CPUInformation info;
|
||||
return info;
|
||||
}
|
||||
|
||||
int SystemStats::getNumCpus() noexcept { return getCPUInformation().numCpus; }
|
||||
bool SystemStats::hasMMX() noexcept { return getCPUInformation().hasMMX; }
|
||||
bool SystemStats::hasSSE() noexcept { return getCPUInformation().hasSSE; }
|
||||
bool SystemStats::hasSSE2() noexcept { return getCPUInformation().hasSSE2; }
|
||||
bool SystemStats::hasSSE3() noexcept { return getCPUInformation().hasSSE3; }
|
||||
bool SystemStats::has3DNow() noexcept { return getCPUInformation().has3DNow; }
|
||||
|
||||
//==============================================================================
|
||||
String SystemStats::getStackBacktrace()
|
||||
|
||||
@@ -121,8 +121,8 @@ public:
|
||||
//==============================================================================
|
||||
// CPU and memory information..
|
||||
|
||||
/** Returns the number of CPUs. */
|
||||
static int getNumCpus() noexcept { return getCPUFlags().numCpus; }
|
||||
/** Returns the number of CPU cores. */
|
||||
static int getNumCpus() noexcept;
|
||||
|
||||
/** Returns the approximate CPU speed.
|
||||
@returns the speed in megahertz, e.g. 1500, 2500, 32000 (depending on
|
||||
@@ -135,17 +135,11 @@ public:
|
||||
*/
|
||||
static String getCpuVendor();
|
||||
|
||||
/** Checks whether Intel MMX instructions are available. */
|
||||
static bool hasMMX() noexcept { return getCPUFlags().hasMMX; }
|
||||
|
||||
/** Checks whether Intel SSE instructions are available. */
|
||||
static bool hasSSE() noexcept { return getCPUFlags().hasSSE; }
|
||||
|
||||
/** Checks whether Intel SSE2 instructions are available. */
|
||||
static bool hasSSE2() noexcept { return getCPUFlags().hasSSE2; }
|
||||
|
||||
/** Checks whether AMD 3DNOW instructions are available. */
|
||||
static bool has3DNow() noexcept { return getCPUFlags().has3DNow; }
|
||||
static bool hasMMX() noexcept; /**< Returns true if Intel MMX 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 has3DNow() noexcept; /**< Returns true if AMD 3DNOW instructions are available. */
|
||||
|
||||
//==============================================================================
|
||||
/** Finds out how much RAM is in the machine.
|
||||
@@ -179,19 +173,8 @@ public:
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
struct CPUFlags
|
||||
{
|
||||
CPUFlags();
|
||||
|
||||
int numCpus;
|
||||
bool hasMMX : 1;
|
||||
bool hasSSE : 1;
|
||||
bool hasSSE2 : 1;
|
||||
bool has3DNow : 1;
|
||||
};
|
||||
|
||||
SystemStats();
|
||||
static const CPUFlags& getCPUFlags();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user