summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llappviewer.cpp15
-rw-r--r--indra/newview/llmemoryview.cpp51
-rw-r--r--indra/newview/llviewerwindow.cpp8
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml10
5 files changed, 90 insertions, 5 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index ced46c7294..72d83ad024 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1852,6 +1852,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>DebugShowMemory</key>
+ <map>
+ <key>Comment</key>
+ <string>Show Total Allocated Memory</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>DebugShowRenderInfo</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 6a9dfaf21b..87c0085226 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1057,6 +1057,8 @@ bool LLAppViewer::mainLoop()
//clear call stack records
llclearcallstacks;
+ MEM_TRACK
+
//check memory availability information
{
if(memory_check_interval < memCheckTimer.getElapsedTimeF32())
@@ -1101,6 +1103,8 @@ bool LLAppViewer::mainLoop()
}
#endif
+ MEM_TRACK
+
//memory leaking simulation
LLFloaterMemLeak* mem_leak_instance =
LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
@@ -1162,6 +1166,8 @@ bool LLAppViewer::mainLoop()
resumeMainloopTimeout();
}
+ MEM_TRACK
+
if (gDoDisconnect && (LLStartUp::getStartupState() == STATE_STARTED))
{
pauseMainloopTimeout();
@@ -1183,6 +1189,8 @@ bool LLAppViewer::mainLoop()
}
+ MEM_TRACK
+
pingMainloopTimeout("Main:Sleep");
pauseMainloopTimeout();
@@ -1296,7 +1304,10 @@ bool LLAppViewer::mainLoop()
resumeMainloopTimeout();
pingMainloopTimeout("Main:End");
- }
+ }
+
+ MEM_TRACK
+
}
catch(std::bad_alloc)
{
@@ -1779,6 +1790,8 @@ bool LLAppViewer::cleanup()
ll_close_fail_log();
+ MEM_TRACK_RELEASE
+
llinfos << "Goodbye!" << llendflush;
// return 0;
diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp
index 9a244e2562..397a77c4e3 100644
--- a/indra/newview/llmemoryview.cpp
+++ b/indra/newview/llmemoryview.cpp
@@ -37,6 +37,7 @@
#include <sstream>
#include <boost/algorithm/string/split.hpp>
+#include "llmemory.h"
LLMemoryView::LLMemoryView(const LLMemoryView::Params& p)
: LLView(p),
@@ -148,13 +149,14 @@ void LLMemoryView::draw()
// cut off lines on bottom
U32 max_lines = U32((height - 2 * line_height) / line_height);
- std::vector<LLWString>::const_iterator end = mLines.end();
+ y_pos = height - MARGIN_AMT - line_height;
+ y_off = 0.f;
+
+#if !MEM_TRACK_MEM
+ std::vector<LLWString>::const_iterator end = mLines.end();
if(mLines.size() > max_lines) {
end = mLines.begin() + max_lines;
}
-
- y_pos = height - MARGIN_AMT - line_height;
- y_off = 0.f;
for (std::vector<LLWString>::const_iterator i = mLines.begin(); i != end; ++i)
{
font->render(*i, 0, MARGIN_AMT, y_pos - y_off,
@@ -169,6 +171,47 @@ void LLMemoryView::draw()
y_off += line_height;
}
+#else
+ LLMemTracker::getInstance()->preDraw() ;
+
+ {
+ F32 x_pos = MARGIN_AMT ;
+ U32 lines = 0 ;
+ const char* str = LLMemTracker::getInstance()->getNextLine() ;
+ while(str != NULL)
+ {
+ lines++ ;
+ font->renderUTF8(str, 0, x_pos, y_pos - y_off,
+ LLColor4::white,
+ LLFontGL::LEFT,
+ LLFontGL::BASELINE,
+ LLFontGL::NORMAL,
+ LLFontGL::DROP_SHADOW,
+ S32_MAX,
+ target_width,
+ NULL, FALSE);
+
+ str = LLMemTracker::getInstance()->getNextLine() ;
+ y_off += line_height;
+
+ if(lines >= max_lines)
+ {
+ lines = 0 ;
+ x_pos += 512.f ;
+ if(x_pos + 512.f > target_width)
+ {
+ break ;
+ }
+
+ y_pos = height - MARGIN_AMT - line_height;
+ y_off = 0.f;
+ }
+ }
+ }
+
+ LLMemTracker::getInstance()->postDraw() ;
+#endif
+
#if MEM_TRACK_TYPE
S32 left, top, right, bottom;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 166b110412..ca0478ee0c 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -351,6 +351,14 @@ public:
addText(xpos, ypos, llformat("Time: %d:%02d:%02d", hours,mins,secs)); ypos += y_inc;
}
+#if LL_WINDOWS
+ if (gSavedSettings.getBOOL("DebugShowMemory"))
+ {
+ addText(xpos, ypos, llformat("Memory: %d (KB)", LLMemory::getWorkingSetSize() / 1024));
+ ypos += y_inc;
+ }
+#endif
+
if (gDisplayCameraPos)
{
std::string camera_view_text;
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index c2735c85e4..08ae0c233e 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -1990,6 +1990,16 @@
function="ToggleControl"
parameter="DebugShowColor" />
</menu_item_check>
+ <menu_item_check
+ label="Show Memory"
+ name="Show Memory">
+ <menu_item_check.on_check
+ function="CheckControl"
+ parameter="DebugShowMemory" />
+ <menu_item_check.on_click
+ function="ToggleControl"
+ parameter="DebugShowMemory" />
+ </menu_item_check>
<menu_item_separator/>