parent
6a964e4fa4
commit
43049260e2
5 changed files with 12 additions and 12 deletions
|
@ -24,8 +24,8 @@ extern "C" long sysconf(int);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAXSWNAMELENGHT 40
|
#define MAXSWNAMELENGTH 40
|
||||||
#define MAXSWTIMELENGHT 12
|
#define MAXSWTIMELENGTH 12
|
||||||
|
|
||||||
TStopWatch TStopWatch::StopWatch[10];
|
TStopWatch TStopWatch::StopWatch[10];
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ bool TSystem::memoryShortage() {
|
||||||
|
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
TINT64 TSystem::getFreeMemorySize(bool onlyPhisicalMemory) {
|
TINT64 TSystem::getFreeMemorySize(bool onlyPhysicalMemory) {
|
||||||
TINT64 totalFree = 0;
|
TINT64 totalFree = 0;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -234,7 +234,7 @@ TINT64 TSystem::getFreeMemorySize(bool onlyPhisicalMemory) {
|
||||||
buff.dwLength = sizeof(MEMORYSTATUSEX);
|
buff.dwLength = sizeof(MEMORYSTATUSEX);
|
||||||
GlobalMemoryStatusEx(&buff);
|
GlobalMemoryStatusEx(&buff);
|
||||||
|
|
||||||
if (onlyPhisicalMemory)
|
if (onlyPhysicalMemory)
|
||||||
return buff.ullAvailPhys >> 10;
|
return buff.ullAvailPhys >> 10;
|
||||||
else
|
else
|
||||||
return buff.ullAvailPageFile >> 10;
|
return buff.ullAvailPageFile >> 10;
|
||||||
|
@ -269,7 +269,7 @@ TINT64 TSystem::getFreeMemorySize(bool onlyPhisicalMemory) {
|
||||||
struct sysinfo *sysInfo = (struct sysinfo *)calloc(1, sizeof(struct sysinfo));
|
struct sysinfo *sysInfo = (struct sysinfo *)calloc(1, sizeof(struct sysinfo));
|
||||||
|
|
||||||
if (!sysinfo(sysInfo)) {
|
if (!sysinfo(sysInfo)) {
|
||||||
if (onlyPhisicalMemory)
|
if (onlyPhysicalMemory)
|
||||||
totalFree = sysInfo->freeram;
|
totalFree = sysInfo->freeram;
|
||||||
else
|
else
|
||||||
totalFree = sysInfo->freeram + sysInfo->freeswap;
|
totalFree = sysInfo->freeram + sysInfo->freeswap;
|
||||||
|
@ -403,12 +403,12 @@ TINT64 TSystem::getFreeDiskSize(const TFilePath &diskName) {
|
||||||
|
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
TINT64 TSystem::getMemorySize(bool onlyPhisicalMemory) {
|
TINT64 TSystem::getMemorySize(bool onlyPhysicalMemory) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
MEMORYSTATUS buff;
|
MEMORYSTATUS buff;
|
||||||
GlobalMemoryStatus(&buff);
|
GlobalMemoryStatus(&buff);
|
||||||
if (onlyPhisicalMemory)
|
if (onlyPhysicalMemory)
|
||||||
return buff.dwTotalPhys >> 10;
|
return buff.dwTotalPhys >> 10;
|
||||||
else
|
else
|
||||||
return buff.dwTotalPageFile >> 10;
|
return buff.dwTotalPageFile >> 10;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#elif defined(MACOSX)
|
#elif defined(MACOSX)
|
||||||
#define TNZ_MACHINE_CHANNEL_ORDER_MRGB 1
|
#define TNZ_MACHINE_CHANNEL_ORDER_MRGB 1
|
||||||
#else
|
#else
|
||||||
@UNKNOW PLATFORM @
|
@UNKNOWN PLATFORM @
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(TNZ_LITTLE_ENDIAN)
|
#if !defined(TNZ_LITTLE_ENDIAN)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#elif defined(MACOSX)
|
#elif defined(MACOSX)
|
||||||
#define TNZ_MACHINE_CHANNEL_ORDER_MRGB 1
|
#define TNZ_MACHINE_CHANNEL_ORDER_MRGB 1
|
||||||
#else
|
#else
|
||||||
@UNKNOW PLATFORM @
|
@UNKNOWN PLATFORM @
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(TNZ_LITTLE_ENDIAN)
|
#if !defined(TNZ_LITTLE_ENDIAN)
|
||||||
|
|
|
@ -194,13 +194,13 @@ DVAPI TINT64 getFreeDiskSize(const TFilePath &);
|
||||||
|
|
||||||
/*! returns available physical (+ virtual mem if boolean=true) memory in KBytes
|
/*! returns available physical (+ virtual mem if boolean=true) memory in KBytes
|
||||||
*/
|
*/
|
||||||
DVAPI TINT64 getFreeMemorySize(bool onlyPhisicalMemory);
|
DVAPI TINT64 getFreeMemorySize(bool onlyPhysicalMemory);
|
||||||
|
|
||||||
/*! return total physical (+ virtual mem if boolean=true) memory in kbytes */
|
/*! return total physical (+ virtual mem if boolean=true) memory in kbytes */
|
||||||
DVAPI TINT64 getMemorySize(bool onlyPhisicalMemory);
|
DVAPI TINT64 getMemorySize(bool onlyPhysicalMemory);
|
||||||
|
|
||||||
/*! return true if not enough memory. It can happen for 2 reasons:
|
/*! return true if not enough memory. It can happen for 2 reasons:
|
||||||
1) free phisical memory is close to 0;
|
1) free physical memory is close to 0;
|
||||||
2) the calling process has allocated the maximum amount of memory allowed
|
2) the calling process has allocated the maximum amount of memory allowed
|
||||||
for a single process(typically, for a 32 bits machine, 2GB)*/
|
for a single process(typically, for a 32 bits machine, 2GB)*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue