21#if !defined SOCPUDEVICE_H
24#include <Inventor/devices/SoDevice.h>
26#include <Inventor/STL/vector>
27#include <Inventor/STL/string>
28#include <Inventor/STL/map>
30#include <Inventor/threads/SbThreadMutex.h>
32#include <Inventor/SbString.h>
33#include <Inventor/errors/SoDebugError.h>
155 unsigned long long allocatedMem, freeMem;
156 dev.getMemoryInfo( allocatedMem, freeMem );
158 return os <<
"[CPU name]: " << dev.m_name.
toLatin1() <<
"\n" << \
159 "[RAM Size]: " << (dev.m_totalMemory)/(1024*1024) <<
"MB" <<
"\n" <<
160 "[Available RAM size]: " << freeMem /(1024*1024) <<
"MB" <<
"\n" <<
161 "[Cores number]: " << dev.m_coresCount <<
"\n" << \
162 "[L1 cache size]: " << dev.m_cacheSize[0]/1024 <<
"KB\n" << \
163 "[L2 cache size]: " << dev.m_cacheSize[1]/1024 <<
"KB\n" << \
164 "[L3 cache size]: " << dev.m_cacheSize[2]/1024 <<
"KB\n" << \
165 "[MMX]: " << (dev.m_hasMMX?
"available":
"not available") <<
"\n" << \
166 "[SSE level]: " << dev.m_sseLevel;
172 static unsigned int s_sse_alignement;
175 virtual unsigned long long getProcessMemory()
const;
178 virtual unsigned long long getPeakProcessMemory()
const;
193 static bool findFirstDeviceFunc(
SoDevice* device );
196 static bool findDevicesCount(
SoDevice* device );
201 void getMemoryInfo(
unsigned long long& allocatedMem,
unsigned long long& freeMem )
const;
203 typedef std::map<std::string, unsigned long long> MemInfoMap;
206 static void fetchMemInfos( MemInfoMap& memInfo );
212 static bool getTotalAndFreeMem(
unsigned long long& totalMem,
unsigned long long& freeMem );
215 unsigned long long m_totalMemory;
236 unsigned int m_coresCount;
239 unsigned int m_cacheSize[3];
245 static unsigned int s_processorsCount;
248 static int s_initRefCount;
253inline unsigned long long
256 return m_totalMemory;
263 return m_architecture;
Class for smart character strings.
const char * toLatin1() const
Returns the string as a Latin-1/ASCII C string.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable mutex c...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> CPU device manag...
ProcessorArchitecture getArchitecture() const
Returns the architecture of the processor.
static void initClass()
This function detects the CPU available in the system.
virtual SbString getDeviceName() const
Returns the device name.
bool isActive() const
Returns true if the CPU is active in the system.
virtual unsigned int getLogicalUnits() const
Returns the number of cores available on this device.
static unsigned int getDevicesCount()
Returns the total number of cores available in the sytem.
virtual unsigned long long getAvailableMemory() const
Returns the current available memory of this device in bytes.
static SoCpuDevice * getDevice(int index=0)
Returns the SoCpuDevice.
int getSSELevel() const
Returns the SSE instruction level available on this device.
static SoCpuDevice * findFirstAvailableDevice()
Returns the first available device found in the system.
friend std::ostream & operator<<(std::ostream &os, const SoCpuDevice &dev)
Prints information about the device.
bool hasMMX() const
Returns true if MMX instructions are supported on this device.
bool hasSSE() const
Returns if SSE instructions are supported on this device.
ProcessorArchitecture
This enum contains the list of possible architectures for the CPU.
virtual unsigned long long getTotalMemory() const
Returns the total memory of this device in bytes.
virtual SbString getDriverVersion() const
Returns the driver version of this device.
static void exitClass()
This function frees the allocated memory.
unsigned int getCacheSize(int cacheLevel) const
Returns the size of the cache on this device in bytes.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract device ...