ML Reference
|
Singleton class that provides hardware specific information. More...
#include <mlCPUInfo.h>
Public Member Functions | |
bool | isPentium () const |
Returns true if this is a pentium based system. | |
bool | hasMMX () const |
Returns true if MMX is supported. | |
bool | hasSSE () const |
Returns true if SSE is supported. | |
bool | hasSSE2 () const |
Returns true if SSE2 is supported. | |
bool | hasSSE3 () const |
Returns true if SSE3 is supported. | |
bool | hasSSSE3 () const |
Returns true if SSSE3 is supported. | |
bool | hasSSE4_1 () const |
Returns true if SSE4.1 is supported. | |
bool | hasSSE4_2 () const |
Returns true if SSE4.2 is supported. | |
bool | hasSSE4a () const |
Returns true if SSE4a is supported. | |
bool | hasSSE5 () const |
Returns true if SSE5 is supported. | |
bool | hasAVX () const |
Returns true if AVX is supported. | |
bool | has3DNow () const |
Returns true if 3DNow! is supported. | |
bool | has3DNowP () const |
Returns true if 3DNow+ is supported. | |
void | getCacheSizes (unsigned int &csize_l1, unsigned int &csize_l2) const |
Returns L1 and L2 cache sizes. | |
const std::string & | getVendorID () const |
Returns the CPU's vendor identifier (something like "AuthenticAMD" for example). | |
const std::string & | getModelID () const |
Returns the CPU's model identifier if supported. | |
void | getCPUCount (unsigned int &numPhysicalProcessors, unsigned int &numCores, unsigned int &numVirtualProcessors) |
Returns the machines CPU configuration, that means the number of actual CPUs, the number of cores and the total number of processors. | |
unsigned int | getNumPhysicalProcessors () const |
Returns the total number of actual CPUs. | |
unsigned int | getNumCores () const |
Returns the total number of cores. | |
unsigned int | getNumVirtualProcessors () const |
Returns the total number of virtual processors. | |
unsigned int | getCPUFrequency () const |
Returns the cpu frequency in mega hertz. | |
void | printInfo (std::ostream &ostr) |
Formated output of system information to stdout. | |
Static Public Member Functions | |
static CPUInfo & | getInstance () |
Returns the single existing object of this class. | |
Protected Member Functions | |
CPUInfo () | |
This constructor must not be called from anywhere else but the getInstance() method (which does call this function if the static pointer to the valid object is not set yet). | |
Singleton class that provides hardware specific information.
To get a pointer to a valid object of this type use the getInstance() method. The getCPUCount method is required to get an overview of the machines CPU ressources. There are different layers which influence the performance if used for multithreading. The lowest level would be Hyper-Threading (two or more threads running on one core. Those share a lot more ressources than threads running on different cores. Again those share ressources (cache for example) that threads on different CPUs would share. This hierarchy can give information on the quality of parallelization. Information about the IA-32 platform can be read via the cpuid command. A lot of valuable information can be found on this page: http://www.sandpile.org/ia32/cpuid.htm or in the "IntelĀ® Processor Identification and the CPUID Instruction". I tried to find an optimal way for providing information but not having to struggle too much with Intel's way to mystify data. Therefore there is primary use of the extended registers that provide lots of information in a more sane fashion.
Definition at line 43 of file mlCPUInfo.h.
|
protected |
This constructor must not be called from anywhere else but the getInstance() method (which does call this function if the static pointer to the valid object is not set yet).
void ml::CPUInfo::getCacheSizes | ( | unsigned int & | csize_l1, |
unsigned int & | csize_l2 ) const |
Returns L1 and L2 cache sizes.
void ml::CPUInfo::getCPUCount | ( | unsigned int & | numPhysicalProcessors, |
unsigned int & | numCores, | ||
unsigned int & | numVirtualProcessors ) |
Returns the machines CPU configuration, that means the number of actual CPUs, the number of cores and the total number of processors.
numPhysicalProcessors | The total number of actual CPUs. |
numCores | The total number of cores. |
numVirtualProcessors | The total number of virtual processors. |
unsigned int ml::CPUInfo::getCPUFrequency | ( | ) | const |
Returns the cpu frequency in mega hertz.
|
static |
Returns the single existing object of this class.
The concept of this class is based on the Singleton design pattern which ensures there is only one object of this class. (NOT THREADSAFE!)
|
inline |
Returns the CPU's model identifier if supported.
Definition at line 127 of file mlCPUInfo.h.
unsigned int ml::CPUInfo::getNumCores | ( | ) | const |
Returns the total number of cores.
unsigned int ml::CPUInfo::getNumPhysicalProcessors | ( | ) | const |
Returns the total number of actual CPUs.
unsigned int ml::CPUInfo::getNumVirtualProcessors | ( | ) | const |
Returns the total number of virtual processors.
|
inline |
Returns the CPU's vendor identifier (something like "AuthenticAMD" for example).
Definition at line 123 of file mlCPUInfo.h.
|
inline |
Returns true
if 3DNow! is supported.
Definition at line 109 of file mlCPUInfo.h.
|
inline |
Returns true
if 3DNow+ is supported.
Definition at line 113 of file mlCPUInfo.h.
|
inline |
Returns true
if AVX is supported.
Definition at line 105 of file mlCPUInfo.h.
|
inline |
Returns true
if MMX is supported.
Definition at line 69 of file mlCPUInfo.h.
|
inline |
Returns true
if SSE is supported.
Definition at line 73 of file mlCPUInfo.h.
|
inline |
Returns true
if SSE2 is supported.
Definition at line 77 of file mlCPUInfo.h.
|
inline |
Returns true
if SSE3 is supported.
Definition at line 81 of file mlCPUInfo.h.
|
inline |
Returns true
if SSE4.1 is supported.
Definition at line 89 of file mlCPUInfo.h.
|
inline |
Returns true
if SSE4.2 is supported.
Definition at line 93 of file mlCPUInfo.h.
|
inline |
Returns true
if SSE4a is supported.
Definition at line 97 of file mlCPUInfo.h.
|
inline |
Returns true
if SSE5 is supported.
Definition at line 101 of file mlCPUInfo.h.
|
inline |
Returns true
if SSSE3 is supported.
Definition at line 85 of file mlCPUInfo.h.
|
inline |
Returns true
if this is a pentium based system.
Definition at line 65 of file mlCPUInfo.h.
void ml::CPUInfo::printInfo | ( | std::ostream & | ostr | ) |
Formated output of system information to stdout.