diff options
author | Jacek Antonelli | 2008-08-15 23:45:04 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:04 -0500 |
commit | 117e22047c5752352342d64e3fb7ce00a4eb8113 (patch) | |
tree | e32de2cfba0dda8705ae528fcd1fbe23ba075685 /linden/indra/newview/llmemoryview.cpp | |
parent | Second Life viewer sources 1.18.0.6 (diff) | |
download | meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.zip meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.gz meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.bz2 meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.xz |
Second Life viewer sources 1.18.1.2
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llmemoryview.cpp | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/linden/indra/newview/llmemoryview.cpp b/linden/indra/newview/llmemoryview.cpp index 1d92bff..c29b33f 100644 --- a/linden/indra/newview/llmemoryview.cpp +++ b/linden/indra/newview/llmemoryview.cpp | |||
@@ -45,10 +45,20 @@ | |||
45 | 45 | ||
46 | #include "llfasttimer.h" | 46 | #include "llfasttimer.h" |
47 | 47 | ||
48 | |||
49 | |||
48 | LLMemoryView::LLMemoryView(const std::string& name, const LLRect& rect) | 50 | LLMemoryView::LLMemoryView(const std::string& name, const LLRect& rect) |
49 | : LLView(name, rect, TRUE) | 51 | : LLView(name, rect, TRUE), |
52 | mDelay(120) | ||
50 | { | 53 | { |
51 | setVisible(FALSE); | 54 | setVisible(FALSE); |
55 | mDumpTimer.reset(); | ||
56 | |||
57 | #ifdef MEM_DUMP_DATA | ||
58 | // clear out file. | ||
59 | FILE *dump = fopen("memusagedump.txt", "w"); | ||
60 | fclose(dump); | ||
61 | #endif | ||
52 | } | 62 | } |
53 | 63 | ||
54 | LLMemoryView::~LLMemoryView() | 64 | LLMemoryView::~LLMemoryView() |
@@ -196,7 +206,7 @@ void LLMemoryView::draw() | |||
196 | peak += maxbytes; | 206 | peak += maxbytes; |
197 | S32 mbytes = bytes >> 20; | 207 | S32 mbytes = bytes >> 20; |
198 | 208 | ||
199 | tdesc = llformat("%s [%4d MB]",mtv_display_table[i].desc,mbytes); | 209 | tdesc = llformat("%s [%4d MB] in %06d NEWS",mtv_display_table[i].desc,mbytes, LLMemType::sNewCount[tidx]); |
200 | LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); | 210 | LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); |
201 | 211 | ||
202 | y -= (texth + 2); | 212 | y -= (texth + 2); |
@@ -239,7 +249,46 @@ void LLMemoryView::draw() | |||
239 | y -= (texth + 2); | 249 | y -= (texth + 2); |
240 | } | 250 | } |
241 | 251 | ||
252 | dumpData(); | ||
253 | |||
242 | #endif | 254 | #endif |
243 | 255 | ||
244 | LLView::draw(); | 256 | LLView::draw(); |
245 | } | 257 | } |
258 | |||
259 | void LLMemoryView::setDataDumpInterval(float delay) | ||
260 | { | ||
261 | mDelay = delay; | ||
262 | } | ||
263 | |||
264 | void LLMemoryView::dumpData() | ||
265 | { | ||
266 | #if MEM_TRACK_TYPE && MEM_DUMP_DATA | ||
267 | if (mDelay && (mDumpTimer.getElapsedTimeF32() > mDelay )) | ||
268 | { | ||
269 | // reset timer | ||
270 | mDumpTimer.reset(); | ||
271 | // append dump info to text file | ||
272 | FILE *dump = fopen("memusagedump.txt", "a"); | ||
273 | |||
274 | if (dump) | ||
275 | { | ||
276 | // write out total memory usage | ||
277 | fprintf (dump, "Total memory in use = %09d (%03d MB)\n", LLMemType::sTotalMem, LLMemType::sTotalMem>>20); | ||
278 | fprintf (dump, "High Water Mark = %09d (%03d MB)\n\n", LLMemType::sMaxTotalMem, LLMemType::sMaxTotalMem>>20); | ||
279 | // dump out usage of 'new' for each memory type | ||
280 | for (S32 i=0; i<LLMemType::MTYPE_NUM_TYPES; i++) | ||
281 | { | ||
282 | if (LLMemType::sMemCount[i]) | ||
283 | { | ||
284 | std::string outData = llformat("MEM: % 20s %09d %03d MB (%09d %03d MB) in %06d News", LLMemType::sTypeDesc[i], LLMemType::sMemCount[i], LLMemType::sMemCount[i]>>20, LLMemType::sMaxMemCount[i], LLMemType::sMaxMemCount[i]>>20, LLMemType::sNewCount[i]); | ||
285 | fprintf (dump, "%s\n", outData.c_str()); | ||
286 | } | ||
287 | } | ||
288 | fprintf (dump, "\n\n"); | ||
289 | |||
290 | fclose(dump); | ||
291 | } | ||
292 | } | ||
293 | #endif | ||
294 | } | ||