diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2010-10-14 17:01:39 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2010-10-14 17:01:39 -0600 |
commit | 5ee546eb4e446632c32e62a5234241fd6498f281 (patch) | |
tree | 7f185cff390b3ed0adfb26ab141a1aa21883a1e5 /indra/newview/llappviewer.cpp | |
parent | dedc78431f938beac5c8750ff446eeab44aeb163 (diff) |
for SH-335: create a debug tool to track of memory availability.
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 333c92e50d..f6cff3d443 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -984,6 +984,7 @@ bool LLAppViewer::mainLoop() LLVoiceClient::getInstance()->init(gServicePump); LLTimer frameTimer,idleTimer; LLTimer debugTime; + LLFrameTimer memCheckTimer; LLViewerJoystick* joystick(LLViewerJoystick::getInstance()); joystick->setNeedsReset(true); @@ -994,11 +995,29 @@ bool LLAppViewer::mainLoop() // point of posting. LLSD newFrame; + const F32 memory_check_interval = 1.0f ; //second + // Handle messages while (!LLApp::isExiting()) { LLFastTimer::nextFrame(); // Should be outside of any timer instances + //clear call stack records + llclearcallstacks; + + //check memory availability information + { + if(memory_check_interval < memCheckTimer.getElapsedTimeF32()) + { + memCheckTimer.reset() ; + + //update the availability of memory + gSysMemory.getAvailableMemoryKB(mAvailPhysicalMemInKB, mAvailVirtualMemInKB) ; + } + llcallstacks << "Available physical mem(KB): " << mAvailPhysicalMemInKB << llcallstacksendl ; + llcallstacks << "Available virtual mem(KB): " << mAvailVirtualMemInKB << llcallstacksendl ; + } + try { pingMainloopTimeout("Main:MiscNativeWindowEvents"); @@ -1225,11 +1244,20 @@ bool LLAppViewer::mainLoop() resumeMainloopTimeout(); pingMainloopTimeout("Main:End"); - } - + } } catch(std::bad_alloc) { + { + llinfos << "Availabe physical memory(KB) at the beginning of the frame: " << mAvailPhysicalMemInKB << llendl ; + llinfos << "Availabe virtual memory(KB) at the beginning of the frame: " << mAvailVirtualMemInKB << llendl ; + + gSysMemory.getAvailableMemoryKB(mAvailPhysicalMemInKB, mAvailVirtualMemInKB) ; + + llinfos << "Current availabe physical memory(KB): " << mAvailPhysicalMemInKB << llendl ; + llinfos << "Current availabe virtual memory(KB): " << mAvailVirtualMemInKB << llendl ; + } + //stop memory leaking simulation LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); |