summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2010-10-14 17:01:39 -0600
committerXiaohong Bao <bao@lindenlab.com>2010-10-14 17:01:39 -0600
commit5ee546eb4e446632c32e62a5234241fd6498f281 (patch)
tree7f185cff390b3ed0adfb26ab141a1aa21883a1e5 /indra/llcommon
parentdedc78431f938beac5c8750ff446eeab44aeb163 (diff)
for SH-335: create a debug tool to track of memory availability.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llsys.cpp19
-rw-r--r--indra/llcommon/llsys.h3
2 files changed, 22 insertions, 0 deletions
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 00c94404d4..7a82a17d0b 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -635,6 +635,25 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const
}
}
+void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) const
+{
+#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..35425f38ed 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.
+ void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) const;
};