diff options
author | Loren Shih <seraph@lindenlab.com> | 2010-10-27 16:19:18 -0400 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2010-10-27 16:19:18 -0400 |
commit | 639bb11eefaa82e2875be99fc2222162fe45e437 (patch) | |
tree | 85300dcdb3b5ef6d365359190ccf5e00c59377cd /indra/llcommon | |
parent | 158e647247f67344a5d7a9dde6ccc80bad615c9a (diff) | |
parent | 8d4dd1bcb9184093df807af12364f499c1f5fccf (diff) |
Automated merge from viewer-development-shining
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llsys.cpp | 20 | ||||
-rw-r--r-- | indra/llcommon/llsys.h | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 00c94404d4..10cdc7087b 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -635,6 +635,26 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const } } +//static +void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) +{ +#if LL_WINDOWS + MEMORYSTATUSEX state; + state.dwLength = sizeof(state); + GlobalMemoryStatusEx(&state); + + avail_physical_mem_kb = (U32)(state.ullAvailPhys/1024) ; + avail_virtual_mem_kb = (U32)(state.ullAvailVirtual/1024) ; + +#else + //do not know how to collect available memory info for other systems. + //leave it blank here for now. + + avail_physical_mem_kb = -1 ; + avail_virtual_mem_kb = -1 ; +#endif +} + void LLMemoryInfo::stream(std::ostream& s) const { #if LL_WINDOWS diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 39af74e5c8..41a4f25000 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -114,6 +114,9 @@ public: ** be returned. */ U32 getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes + + //get the available memory infomation in KiloBytes. + static void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb); }; |