diff options
author | Jacek Antonelli | 2010-02-09 21:14:55 -0600 |
---|---|---|
committer | Jacek Antonelli | 2010-02-16 18:50:21 -0600 |
commit | 45277e02ea120efb90ffc10beb33fa2364d631aa (patch) | |
tree | 3f76fe085798d995330979330d5db293bd7f4534 /linden/indra | |
parent | Ported many texture engine changes from Snowglobe. (diff) | |
download | meta-impy-45277e02ea120efb90ffc10beb33fa2364d631aa.zip meta-impy-45277e02ea120efb90ffc10beb33fa2364d631aa.tar.gz meta-impy-45277e02ea120efb90ffc10beb33fa2364d631aa.tar.bz2 meta-impy-45277e02ea120efb90ffc10beb33fa2364d631aa.tar.xz |
Ported some stats and texture console changes from Snowglobe.
Diffstat (limited to 'linden/indra')
-rw-r--r-- | linden/indra/llcommon/llfasttimer.h | 3 | ||||
-rw-r--r-- | linden/indra/newview/llappviewer.cpp | 3 | ||||
-rw-r--r-- | linden/indra/newview/llfasttimerview.cpp | 1 | ||||
-rw-r--r-- | linden/indra/newview/lltextureview.cpp | 493 | ||||
-rw-r--r-- | linden/indra/newview/lltextureview.h | 35 | ||||
-rw-r--r-- | linden/indra/newview/llviewerstats.cpp | 28 | ||||
-rw-r--r-- | linden/indra/newview/llviewerstats.h | 4 |
7 files changed, 510 insertions, 57 deletions
diff --git a/linden/indra/llcommon/llfasttimer.h b/linden/indra/llcommon/llfasttimer.h index 60281fd..8c1cf47 100644 --- a/linden/indra/llcommon/llfasttimer.h +++ b/linden/indra/llcommon/llfasttimer.h | |||
@@ -161,6 +161,7 @@ public: | |||
161 | FTM_IMAGE_UPDATE, | 161 | FTM_IMAGE_UPDATE, |
162 | FTM_IMAGE_CREATE, | 162 | FTM_IMAGE_CREATE, |
163 | FTM_IMAGE_DECODE, | 163 | FTM_IMAGE_DECODE, |
164 | FTM_IMAGE_READBACK, | ||
164 | FTM_IMAGE_MARK_DIRTY, | 165 | FTM_IMAGE_MARK_DIRTY, |
165 | FTM_PIPELINE, | 166 | FTM_PIPELINE, |
166 | FTM_VFILE_WAIT, | 167 | FTM_VFILE_WAIT, |
@@ -194,7 +195,7 @@ public: | |||
194 | enum { FTM_MAX_DEPTH = 64 }; | 195 | enum { FTM_MAX_DEPTH = 64 }; |
195 | 196 | ||
196 | public: | 197 | public: |
197 | static LLFastTimer::EFastTimerType sCurType; | 198 | static EFastTimerType sCurType; |
198 | 199 | ||
199 | LLFastTimer(EFastTimerType type) | 200 | LLFastTimer(EFastTimerType type) |
200 | { | 201 | { |
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index a630beb..3a509ff 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp | |||
@@ -616,6 +616,9 @@ bool LLAppViewer::init() | |||
616 | ////////////////////////////////////////////////////////////////////////////// | 616 | ////////////////////////////////////////////////////////////////////////////// |
617 | // *FIX: The following code isn't grouped into functions yet. | 617 | // *FIX: The following code isn't grouped into functions yet. |
618 | 618 | ||
619 | // Statistics / debug timer initialization | ||
620 | init_statistics(); | ||
621 | |||
619 | // | 622 | // |
620 | // Various introspection concerning the libs we're using - particularly | 623 | // Various introspection concerning the libs we're using - particularly |
621 | // the libs involved in getting to a full login screen. | 624 | // the libs involved in getting to a full login screen. |
diff --git a/linden/indra/newview/llfasttimerview.cpp b/linden/indra/newview/llfasttimerview.cpp index c9037d0..5e8095e 100644 --- a/linden/indra/newview/llfasttimerview.cpp +++ b/linden/indra/newview/llfasttimerview.cpp | |||
@@ -147,6 +147,7 @@ static struct ft_display_info ft_display_table[] = | |||
147 | { LLFastTimer::FTM_IMAGE_UPDATE, " Image Update", &LLColor4::yellow4, 1 }, | 147 | { LLFastTimer::FTM_IMAGE_UPDATE, " Image Update", &LLColor4::yellow4, 1 }, |
148 | { LLFastTimer::FTM_IMAGE_CREATE, " Image CreateGL",&LLColor4::yellow5, 0 }, | 148 | { LLFastTimer::FTM_IMAGE_CREATE, " Image CreateGL",&LLColor4::yellow5, 0 }, |
149 | { LLFastTimer::FTM_IMAGE_DECODE, " Image Decode", &LLColor4::yellow6, 0 }, | 149 | { LLFastTimer::FTM_IMAGE_DECODE, " Image Decode", &LLColor4::yellow6, 0 }, |
150 | { LLFastTimer::FTM_IMAGE_READBACK, " Image Readback",&LLColor4::red2, 0 }, | ||
150 | { LLFastTimer::FTM_IMAGE_MARK_DIRTY, " Dirty Textures",&LLColor4::red1, 0 }, | 151 | { LLFastTimer::FTM_IMAGE_MARK_DIRTY, " Dirty Textures",&LLColor4::red1, 0 }, |
151 | { LLFastTimer::FTM_STATESORT, " State Sort", &LLColor4::orange1, 1 }, | 152 | { LLFastTimer::FTM_STATESORT, " State Sort", &LLColor4::orange1, 1 }, |
152 | { LLFastTimer::FTM_STATESORT_DRAWABLE, " Drawable", &LLColor4::orange2, 0 }, | 153 | { LLFastTimer::FTM_STATESORT_DRAWABLE, " Drawable", &LLColor4::orange2, 0 }, |
diff --git a/linden/indra/newview/lltextureview.cpp b/linden/indra/newview/lltextureview.cpp index b6159da..cda01fa 100644 --- a/linden/indra/newview/lltextureview.cpp +++ b/linden/indra/newview/lltextureview.cpp | |||
@@ -222,10 +222,10 @@ void LLTextureBar::draw() | |||
222 | { "DSK", LLColor4::blue }, // CACHE_POST | 222 | { "DSK", LLColor4::blue }, // CACHE_POST |
223 | { "NET", LLColor4::green }, // LOAD_FROM_NETWORK | 223 | { "NET", LLColor4::green }, // LOAD_FROM_NETWORK |
224 | { "SIM", LLColor4::green }, // LOAD_FROM_SIMULATOR | 224 | { "SIM", LLColor4::green }, // LOAD_FROM_SIMULATOR |
225 | { "URL", LLColor4::green2 },// LOAD_FROM_HTTP_GET_URL | 225 | { "REQ", LLColor4::yellow },// SEND_HTTP_REQ |
226 | { "HTP", LLColor4::green }, // LOAD_FROM_HTTP_GET_DATA | 226 | { "HTP", LLColor4::green }, // WAIT_HTTP_REQ |
227 | { "DEC", LLColor4::yellow },// DECODE_IMAGE | 227 | { "DEC", LLColor4::yellow },// DECODE_IMAGE |
228 | { "DEC", LLColor4::yellow },// DECODE_IMAGE_UPDATE | 228 | { "DEC", LLColor4::green }, // DECODE_IMAGE_UPDATE |
229 | { "WRT", LLColor4::purple },// WRITE_TO_CACHE | 229 | { "WRT", LLColor4::purple },// WRITE_TO_CACHE |
230 | { "WRT", LLColor4::orange },// WAIT_ON_WRITE | 230 | { "WRT", LLColor4::orange },// WAIT_ON_WRITE |
231 | { "END", LLColor4::red }, // DONE | 231 | { "END", LLColor4::red }, // DONE |
@@ -253,7 +253,7 @@ void LLTextureBar::draw() | |||
253 | 253 | ||
254 | // Draw the progress bar. | 254 | // Draw the progress bar. |
255 | S32 bar_width = 100; | 255 | S32 bar_width = 100; |
256 | S32 bar_left = 280; | 256 | S32 bar_left = 260; |
257 | left = bar_left; | 257 | left = bar_left; |
258 | right = left + bar_width; | 258 | right = left + bar_width; |
259 | 259 | ||
@@ -278,30 +278,31 @@ void LLTextureBar::draw() | |||
278 | S32 pip_x = title_x3 + pip_space/2; | 278 | S32 pip_x = title_x3 + pip_space/2; |
279 | 279 | ||
280 | // Draw the packet pip | 280 | // Draw the packet pip |
281 | const F32 pip_max_time = 5.f; | ||
281 | F32 last_event = mImagep->mLastPacketTimer.getElapsedTimeF32(); | 282 | F32 last_event = mImagep->mLastPacketTimer.getElapsedTimeF32(); |
282 | if (last_event < 1.f) | 283 | if (last_event < pip_max_time) |
283 | { | 284 | { |
284 | clr = LLColor4::white; | 285 | clr = LLColor4::white; |
285 | } | 286 | } |
286 | else | 287 | else |
287 | { | 288 | { |
288 | last_event = mImagep->mRequestDeltaTime; | 289 | last_event = mImagep->mRequestDeltaTime; |
289 | if (last_event < 1.f) | 290 | if (last_event < pip_max_time) |
290 | { | 291 | { |
291 | clr = LLColor4::green; | 292 | clr = LLColor4::green; |
292 | } | 293 | } |
293 | else | 294 | else |
294 | { | 295 | { |
295 | last_event = mImagep->mFetchDeltaTime; | 296 | last_event = mImagep->mFetchDeltaTime; |
296 | if (last_event < 1.f) | 297 | if (last_event < pip_max_time) |
297 | { | 298 | { |
298 | clr = LLColor4::yellow; | 299 | clr = LLColor4::yellow; |
299 | } | 300 | } |
300 | } | 301 | } |
301 | } | 302 | } |
302 | if (last_event < 1.f) | 303 | if (last_event < pip_max_time) |
303 | { | 304 | { |
304 | clr.setAlpha(1.f - last_event); | 305 | clr.setAlpha(1.f - last_event/pip_max_time); |
305 | gGL.color4fv(clr.mV); | 306 | gGL.color4fv(clr.mV); |
306 | gl_rect_2d(pip_x, top, pip_x + pip_width, bottom); | 307 | gl_rect_2d(pip_x, top, pip_x + pip_width, bottom); |
307 | } | 308 | } |
@@ -391,77 +392,93 @@ void LLGLTexMemBar::draw() | |||
391 | S32 max_total_mem = LLViewerImage::sMaxTotalTextureMemInMegaBytes; | 392 | S32 max_total_mem = LLViewerImage::sMaxTotalTextureMemInMegaBytes; |
392 | F32 discard_bias = LLViewerImage::sDesiredDiscardBias; | 393 | F32 discard_bias = LLViewerImage::sDesiredDiscardBias; |
393 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); | 394 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); |
395 | F32 cache_usage = ((F32)(LLAppViewer::getTextureCache()->getUsage()/1024))/1024.f; | ||
396 | F32 cache_max_usage = ((F32)(LLAppViewer::getTextureCache()->getMaxUsage()/1024))/1024.f; | ||
397 | // U32 cache_entries = LLAppViewer::getTextureCache()->getEntries(); | ||
398 | // U32 cache_max_entries = LLAppViewer::getTextureCache()->getMaxEntries(); | ||
394 | 399 | ||
395 | //---------------------------------------------------------------------------- | 400 | //---------------------------------------------------------------------------- |
396 | LLGLSUIDefault gls_ui; | 401 | LLGLSUIDefault gls_ui; |
397 | F32 text_color[] = {1.f, 1.f, 1.f, 0.75f}; | 402 | LLColor4 text_color(1.f, 1.f, 1.f, 0.75f); |
403 | LLColor4 color; | ||
398 | 404 | ||
399 | std::string text; | 405 | std::string text; |
400 | text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB Discard Bias: %.2f", | 406 | text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB Raw Tot: %d MB Bias: %.2f Cache: %.1f/%.1f MB", |
401 | total_mem, | 407 | total_mem, |
402 | max_total_mem, | 408 | max_total_mem, |
403 | bound_mem, | 409 | bound_mem, |
404 | max_bound_mem, | 410 | max_bound_mem, |
405 | discard_bias); | 411 | LLImageRaw::sGlobalRawMemory >> 20, discard_bias, |
412 | cache_usage, cache_max_usage); | ||
413 | //, cache_entries, cache_max_entries | ||
406 | 414 | ||
407 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*3, | 415 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*3, |
408 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | 416 | text_color, LLFontGL::LEFT, LLFontGL::TOP); |
409 | 417 | ||
410 | //---------------------------------------------------------------------------- | 418 | //---------------------------------------------------------------------------- |
411 | S32 bar_left = 380; | 419 | #if 0 |
420 | S32 bar_left = 400; | ||
412 | S32 bar_width = 200; | 421 | S32 bar_width = 200; |
413 | S32 top = line_height*3 - 2; | 422 | S32 top = line_height*3 - 2; |
414 | S32 bottom = top - 6; | 423 | S32 bottom = top - 6; |
415 | S32 left = bar_left; | 424 | S32 left = bar_left; |
416 | S32 right = left + bar_width; | 425 | S32 right = left + bar_width; |
417 | 426 | F32 bar_scale; | |
418 | F32 bar_scale = (F32)bar_width / (max_bound_mem * 1.5f); | ||
419 | 427 | ||
420 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | 428 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
421 | |||
422 | gGL.color4f(0.5f, 0.5f, 0.5f, 0.75f); | ||
423 | gl_rect_2d(left, top, right, bottom); | ||
424 | 429 | ||
425 | 430 | // GL Mem Bar | |
431 | |||
426 | left = bar_left; | 432 | left = bar_left; |
427 | right = left + llfloor(bound_mem * bar_scale); | 433 | text = "GL"; |
428 | if (bound_mem < llfloor(max_bound_mem * texmem_lower_bound_scale)) | 434 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left, line_height*3, |
429 | { | 435 | text_color, LLFontGL::LEFT, LLFontGL::TOP); |
430 | gGL.color4f(0.f, 1.f, 0.f, 0.75f); | 436 | |
431 | } | 437 | left = bar_left+20; |
432 | else if (bound_mem < max_bound_mem) | 438 | right = left + bar_width; |
433 | { | 439 | |
434 | gGL.color4f(1.f, 1.f, 0.f, 0.75f); | 440 | gGL.color4f(0.5f, 0.5f, 0.5f, 0.75f); // grey |
435 | } | ||
436 | else | ||
437 | { | ||
438 | gGL.color4f(1.f, 0.f, 0.f, 0.75f); | ||
439 | } | ||
440 | gl_rect_2d(left, top, right, bottom); | 441 | gl_rect_2d(left, top, right, bottom); |
441 | 442 | ||
442 | bar_scale = (F32)bar_width / (max_total_mem * 1.5f); | 443 | bar_scale = (F32)bar_width / (max_total_mem * 1.5f); |
444 | right = left + llfloor(total_mem * bar_scale); | ||
445 | right = llclamp(right, bar_left, bar_left + bar_width); | ||
446 | |||
447 | color = (total_mem < llfloor(max_total_mem * texmem_lower_bound_scale)) ? LLColor4::green : | ||
448 | (total_mem < max_total_mem) ? LLColor4::yellow : LLColor4::red; | ||
449 | color[VALPHA] = .75f; | ||
450 | glColor4fv(color.mV); | ||
443 | 451 | ||
444 | top = bottom - 2; | 452 | gl_rect_2d(left, top, right, bottom); // red/yellow/green |
445 | bottom = top - 6; | 453 | |
454 | // | ||
455 | bar_left += bar_width + bar_space; | ||
456 | //top = bottom - 2; bottom = top - 6; | ||
457 | |||
458 | // Bound Mem Bar | ||
459 | |||
446 | left = bar_left; | 460 | left = bar_left; |
447 | right = left + llfloor(total_mem * bar_scale); | 461 | text = "GL"; |
448 | if (total_mem < llfloor(max_total_mem * texmem_lower_bound_scale)) | 462 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left, line_height*3, |
449 | { | 463 | text_color, LLFontGL::LEFT, LLFontGL::TOP); |
450 | gGL.color4f(0.f, 1.f, 0.f, 0.75f); | 464 | left = bar_left + 20; |
451 | } | 465 | right = left + bar_width; |
452 | else if (total_mem < max_total_mem) | 466 | |
453 | { | 467 | gGL.color4f(0.5f, 0.5f, 0.5f, 0.75f); |
454 | gGL.color4f(1.f, 1.f, 0.f, 0.75f); | ||
455 | } | ||
456 | else | ||
457 | { | ||
458 | gGL.color4f(1.f, 0.f, 0.f, 0.75f); | ||
459 | } | ||
460 | gl_rect_2d(left, top, right, bottom); | 468 | gl_rect_2d(left, top, right, bottom); |
461 | 469 | ||
470 | color = (bound_mem < llfloor(max_bound_mem * texmem_lower_bound_scale)) ? LLColor4::green : | ||
471 | (bound_mem < max_bound_mem) ? LLColor4::yellow : LLColor4::red; | ||
472 | color[VALPHA] = .75f; | ||
473 | glColor4fv(color.mV); | ||
474 | |||
475 | gl_rect_2d(left, top, right, bottom); | ||
476 | #else | ||
477 | S32 left = 0 ; | ||
478 | #endif | ||
462 | //---------------------------------------------------------------------------- | 479 | //---------------------------------------------------------------------------- |
463 | 480 | ||
464 | text = llformat("Textures: Count: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d IW:%d(%d) RAW:%d mRaw:%d mAux:%d CB:%d", | 481 | text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d IW:%d RAW:%d HTP:%d", |
465 | gImageList.getNumImages(), | 482 | gImageList.getNumImages(), |
466 | LLAppViewer::getTextureFetch()->getNumRequests(), LLAppViewer::getTextureFetch()->getNumDeletes(), | 483 | LLAppViewer::getTextureFetch()->getNumRequests(), LLAppViewer::getTextureFetch()->getNumDeletes(), |
467 | LLAppViewer::getTextureFetch()->mPacketCount, LLAppViewer::getTextureFetch()->mBadPacketCount, | 484 | LLAppViewer::getTextureFetch()->mPacketCount, LLAppViewer::getTextureFetch()->mBadPacketCount, |
@@ -473,6 +490,16 @@ void LLGLTexMemBar::draw() | |||
473 | 490 | ||
474 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*2, | 491 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*2, |
475 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | 492 | text_color, LLFontGL::LEFT, LLFontGL::TOP); |
493 | |||
494 | |||
495 | left = 550; | ||
496 | F32 bandwidth = LLAppViewer::getTextureFetch()->getTextureBandwidth(); | ||
497 | F32 max_bandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); | ||
498 | color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color; | ||
499 | color[VALPHA] = text_color[VALPHA]; | ||
500 | text = llformat("BW:%.0f/%.0f",bandwidth, max_bandwidth); | ||
501 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left, line_height*2, | ||
502 | color, LLFontGL::LEFT, LLFontGL::TOP); | ||
476 | 503 | ||
477 | S32 dx1 = 0; | 504 | S32 dx1 = 0; |
478 | if (LLAppViewer::getTextureFetch()->mDebugPause) | 505 | if (LLAppViewer::getTextureFetch()->mDebugPause) |
@@ -521,6 +548,69 @@ LLRect LLGLTexMemBar::getRequiredRect() | |||
521 | } | 548 | } |
522 | 549 | ||
523 | //////////////////////////////////////////////////////////////////////////// | 550 | //////////////////////////////////////////////////////////////////////////// |
551 | class LLGLTexSizeBar | ||
552 | { | ||
553 | public: | ||
554 | LLGLTexSizeBar(S32 index, S32 left, S32 bottom, S32 right, S32 line_height) | ||
555 | { | ||
556 | mIndex = index ; | ||
557 | mLeft = left ; | ||
558 | mBottom = bottom ; | ||
559 | mRight = right ; | ||
560 | mLineHeight = line_height ; | ||
561 | mTopLoaded = 0 ; | ||
562 | mTopBound = 0 ; | ||
563 | mScale = 1.0f ; | ||
564 | } | ||
565 | |||
566 | void setTop(S32 loaded, S32 bound, F32 scale) {mTopLoaded = loaded ; mTopBound = bound; mScale = scale ;} | ||
567 | |||
568 | void draw(); | ||
569 | BOOL handleHover(S32 x, S32 y, MASK mask, BOOL set_pick_size) ; | ||
570 | |||
571 | private: | ||
572 | S32 mIndex ; | ||
573 | S32 mLeft ; | ||
574 | S32 mBottom ; | ||
575 | S32 mRight ; | ||
576 | S32 mTopLoaded ; | ||
577 | S32 mTopBound ; | ||
578 | S32 mLineHeight ; | ||
579 | F32 mScale ; | ||
580 | }; | ||
581 | |||
582 | BOOL LLGLTexSizeBar::handleHover(S32 x, S32 y, MASK mask, BOOL set_pick_size) | ||
583 | { | ||
584 | if(y > mBottom && (y < mBottom + (S32)(mTopLoaded * mScale) || y < mBottom + (S32)(mTopBound * mScale))) | ||
585 | { | ||
586 | LLImageGL::setCurTexSizebar(mIndex, set_pick_size); | ||
587 | } | ||
588 | return TRUE ; | ||
589 | } | ||
590 | void LLGLTexSizeBar::draw() | ||
591 | { | ||
592 | LLGLSUIDefault gls_ui; | ||
593 | |||
594 | if(LLImageGL::sCurTexSizeBar == mIndex) | ||
595 | { | ||
596 | F32 text_color[] = {1.f, 1.f, 1.f, 0.75f}; | ||
597 | std::string text; | ||
598 | |||
599 | text = llformat("%d", mTopLoaded) ; | ||
600 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, mLeft, mBottom + (S32)(mTopLoaded * mScale) + mLineHeight, | ||
601 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
602 | |||
603 | text = llformat("%d", mTopBound) ; | ||
604 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, (mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale) + mLineHeight, | ||
605 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
606 | } | ||
607 | |||
608 | F32 loaded_color[] = {1.0f, 0.0f, 0.0f, 0.75f}; | ||
609 | F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f}; | ||
610 | gl_rect_2d(mLeft, mBottom + (S32)(mTopLoaded * mScale), (mLeft + mRight) / 2, mBottom, loaded_color) ; | ||
611 | gl_rect_2d((mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale), mRight, mBottom, bound_color) ; | ||
612 | } | ||
613 | //////////////////////////////////////////////////////////////////////////// | ||
524 | 614 | ||
525 | LLTextureView::LLTextureView(const std::string& name, const LLRect& rect) | 615 | LLTextureView::LLTextureView(const std::string& name, const LLRect& rect) |
526 | : LLContainerView(name, rect), | 616 | : LLContainerView(name, rect), |
@@ -591,7 +681,13 @@ void LLTextureView::draw() | |||
591 | << "\t" << cur_discard | 681 | << "\t" << cur_discard |
592 | << llendl; | 682 | << llendl; |
593 | } | 683 | } |
594 | 684 | ||
685 | if (imagep->getID() == LLAppViewer::getTextureFetch()->mDebugID) | ||
686 | { | ||
687 | static S32 debug_count = 0; | ||
688 | ++debug_count; // for breakpoints | ||
689 | } | ||
690 | |||
595 | #if 0 | 691 | #if 0 |
596 | if (imagep->getDontDiscard()) | 692 | if (imagep->getDontDiscard()) |
597 | { | 693 | { |
@@ -792,4 +888,301 @@ BOOL LLTextureView::handleKey(KEY key, MASK mask, BOOL called_from_parent) | |||
792 | return FALSE; | 888 | return FALSE; |
793 | } | 889 | } |
794 | 890 | ||
891 | //----------------------------------------------------------------- | ||
892 | LLTextureSizeView::LLTextureSizeView(const std::string& name) : LLView(name, FALSE) | ||
893 | { | ||
894 | setVisible(FALSE) ; | ||
895 | |||
896 | mTextureSizeBarWidth = 30 ; | ||
897 | } | ||
898 | |||
899 | LLTextureSizeView::~LLTextureSizeView() | ||
900 | { | ||
901 | if(mTextureSizeBar.size()) | ||
902 | { | ||
903 | for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++) | ||
904 | { | ||
905 | delete mTextureSizeBar[i] ; | ||
906 | } | ||
907 | mTextureSizeBar.clear() ; | ||
908 | } | ||
909 | } | ||
910 | void LLTextureSizeView::draw() | ||
911 | { | ||
912 | if(mType == TEXTURE_MEM_OVER_SIZE) | ||
913 | { | ||
914 | drawTextureSizeGraph(); | ||
915 | } | ||
916 | else | ||
917 | { | ||
918 | drawTextureCategoryGraph() ; | ||
919 | } | ||
920 | |||
921 | LLView::draw(); | ||
922 | } | ||
923 | |||
924 | BOOL LLTextureSizeView::handleHover(S32 x, S32 y, MASK mask) | ||
925 | { | ||
926 | if(x > mTextureSizeBarRect.mLeft && x < mTextureSizeBarRect.mRight) | ||
927 | { | ||
928 | mTextureSizeBar[(x - mTextureSizeBarRect.mLeft) / mTextureSizeBarWidth]->handleHover(x, y, mask, (mType == TEXTURE_MEM_OVER_SIZE)) ; | ||
929 | } | ||
930 | |||
931 | return TRUE ; | ||
932 | } | ||
933 | |||
934 | //draw real-time texture mem bar over size | ||
935 | void LLTextureSizeView::drawTextureSizeGraph() | ||
936 | { | ||
937 | if(mTextureSizeBar.size() == 0) | ||
938 | { | ||
939 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); | ||
940 | mTextureSizeBar.resize(LLImageGL::sTextureLoadedCounter.size()) ; | ||
941 | mTextureSizeBarRect.set(700, line_height * 2 + 400, 700 + mTextureSizeBar.size() * mTextureSizeBarWidth, line_height * 2) ; | ||
942 | |||
943 | for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++) | ||
944 | { | ||
945 | mTextureSizeBar[i] = new LLGLTexSizeBar(i, mTextureSizeBarRect.mLeft + i * mTextureSizeBarWidth , | ||
946 | line_height * 2, mTextureSizeBarRect.mLeft + (i + 1) * mTextureSizeBarWidth, line_height) ; | ||
947 | } | ||
948 | } | ||
795 | 949 | ||
950 | F32 size_bar_scale = drawTextureSizeDistributionGraph() ; | ||
951 | for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++) | ||
952 | { | ||
953 | mTextureSizeBar[i]->setTop(LLImageGL::sTextureLoadedCounter[i], LLImageGL::sTextureBoundCounter[i], size_bar_scale) ; | ||
954 | mTextureSizeBar[i]->draw() ; | ||
955 | } | ||
956 | LLImageGL::resetCurTexSizebar(); | ||
957 | } | ||
958 | |||
959 | //draw background of texture size bar graph | ||
960 | F32 LLTextureSizeView::drawTextureSizeDistributionGraph() | ||
961 | { | ||
962 | //scale | ||
963 | F32 scale = 1.0f ; | ||
964 | |||
965 | LLGLSUIDefault gls_ui; | ||
966 | |||
967 | { | ||
968 | S32 count = 0 ; | ||
969 | for(U32 i = 0 ; i < LLImageGL::sTextureLoadedCounter.size() ; i++) | ||
970 | { | ||
971 | if(LLImageGL::sTextureLoadedCounter[i] > count) | ||
972 | { | ||
973 | count = LLImageGL::sTextureLoadedCounter[i] ; | ||
974 | } | ||
975 | } | ||
976 | if(count > mTextureSizeBarRect.getHeight()) | ||
977 | { | ||
978 | scale = (F32)mTextureSizeBarRect.getHeight() / count ; | ||
979 | } | ||
980 | } | ||
981 | |||
982 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); | ||
983 | S32 left = mTextureSizeBarRect.mLeft ; | ||
984 | S32 bottom = mTextureSizeBarRect.mBottom ; | ||
985 | S32 right = mTextureSizeBarRect.mRight ; | ||
986 | S32 top = mTextureSizeBarRect.mTop ; | ||
987 | |||
988 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | ||
989 | |||
990 | //background rect | ||
991 | gl_rect_2d(left - 25, top + 30, right + 100, bottom - 25, LLColor4(0.0f, 0.0f, 0.0f, 0.25f)) ; | ||
992 | |||
993 | //-------------------------------------------------- | ||
994 | gGL.color4f(1.0f, 0.5f, 0.5f, 0.75f); | ||
995 | gl_line_2d(left, bottom, right, bottom) ; //x axis | ||
996 | gl_line_2d(left, bottom, left, top) ; //y axis | ||
997 | |||
998 | //ruler | ||
999 | //-------------------------------------------------- | ||
1000 | gGL.color4f(1.0f, 0.5f, 0.5f, 0.5f); | ||
1001 | for(S32 i = bottom + 50 ; i <= top ; i += 50) | ||
1002 | { | ||
1003 | gl_line_2d(left, i, right, i) ; | ||
1004 | } | ||
1005 | |||
1006 | //texts | ||
1007 | //-------------------------------------------------- | ||
1008 | F32 text_color[] = {1.f, 1.f, 1.f, 0.75f}; | ||
1009 | std::string text; | ||
1010 | |||
1011 | //------- | ||
1012 | //x axis: size label | ||
1013 | text = llformat("%d", 0) ; | ||
1014 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 12, bottom - line_height / 2, | ||
1015 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1016 | for(U32 i = 1 ; i < mTextureSizeBar.size() ; i++) | ||
1017 | { | ||
1018 | text = llformat("%d", (1 << (i / 2)) + ((i & 1) ? ((1 << (i / 2)) >> 1) : 0)) ; | ||
1019 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + i * mTextureSizeBarWidth + 12, bottom - line_height / 2, | ||
1020 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1021 | } | ||
1022 | text = llformat("(w + h)/2") ; | ||
1023 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, right + 10, bottom - line_height / 2, | ||
1024 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1025 | //------- | ||
1026 | |||
1027 | //y axis: number label | ||
1028 | for(S32 i = bottom + 50 ; i <= top ; i += 50) | ||
1029 | { | ||
1030 | text = llformat("%d", (S32)((i - bottom) / scale)) ; | ||
1031 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left - 20, i + line_height / 2 , | ||
1032 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1033 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, right + 5, i + line_height / 2 , | ||
1034 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1035 | } | ||
1036 | |||
1037 | //-------------------------------------------------- | ||
1038 | F32 loaded_color[] = {1.0f, 0.0f, 0.0f, 0.75f}; | ||
1039 | gl_rect_2d(left + 70, top + line_height * 2, left + 90, top + line_height, loaded_color) ; | ||
1040 | text = llformat("Loaded") ; | ||
1041 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 100, top + line_height * 2, | ||
1042 | loaded_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1043 | |||
1044 | F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f}; | ||
1045 | gl_rect_2d(left + 170, top + line_height * 2, left + 190, top + line_height, bound_color) ; | ||
1046 | text = llformat("Bound") ; | ||
1047 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 200, top + line_height * 2, | ||
1048 | bound_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1049 | |||
1050 | //-------------------------------------------------- | ||
1051 | |||
1052 | //title | ||
1053 | text = llformat("Texture Size Distribution") ; | ||
1054 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 250, top + line_height * 3, | ||
1055 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1056 | return scale ; | ||
1057 | } | ||
1058 | |||
1059 | //draw real-time texture mem bar over category | ||
1060 | void LLTextureSizeView::drawTextureCategoryGraph() | ||
1061 | { | ||
1062 | if(mTextureSizeBar.size() == 0) | ||
1063 | { | ||
1064 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); | ||
1065 | mTextureSizeBar.resize(LLImageGL::sTextureMemByCategory.size()) ; | ||
1066 | mTextureSizeBarRect.set(700, line_height * 2 + 400, 700 + mTextureSizeBar.size() * mTextureSizeBarWidth, line_height * 2) ; | ||
1067 | |||
1068 | for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++) | ||
1069 | { | ||
1070 | mTextureSizeBar[i] = new LLGLTexSizeBar(i, mTextureSizeBarRect.mLeft + i * mTextureSizeBarWidth , | ||
1071 | line_height * 2, mTextureSizeBarRect.mLeft + (i + 1) * mTextureSizeBarWidth, line_height) ; | ||
1072 | } | ||
1073 | } | ||
1074 | |||
1075 | F32 size_bar_scale = drawTextureCategoryDistributionGraph() ; | ||
1076 | for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++) | ||
1077 | { | ||
1078 | mTextureSizeBar[i]->setTop(LLImageGL::sTextureMemByCategory[i] >> 20, LLImageGL::sTextureMemByCategoryBound[i] >> 20, size_bar_scale) ; | ||
1079 | mTextureSizeBar[i]->draw() ; | ||
1080 | } | ||
1081 | LLImageGL::resetCurTexSizebar(); | ||
1082 | } | ||
1083 | |||
1084 | //draw background for TEXTURE_MEM_OVER_CATEGORY | ||
1085 | F32 LLTextureSizeView::drawTextureCategoryDistributionGraph() | ||
1086 | { | ||
1087 | //scale | ||
1088 | F32 scale = 4.0f ; | ||
1089 | |||
1090 | LLGLSUIDefault gls_ui; | ||
1091 | |||
1092 | { | ||
1093 | S32 count = 0 ; | ||
1094 | for(U32 i = 0 ; i < LLImageGL::sTextureMemByCategory.size() ; i++) | ||
1095 | { | ||
1096 | S32 tmp = LLImageGL::sTextureMemByCategory[i] >> 20 ; | ||
1097 | if(tmp > count) | ||
1098 | { | ||
1099 | count = tmp ; | ||
1100 | } | ||
1101 | } | ||
1102 | if(count > mTextureSizeBarRect.getHeight() * 0.25f) | ||
1103 | { | ||
1104 | scale = (F32)mTextureSizeBarRect.getHeight() * 0.25f / count ; | ||
1105 | } | ||
1106 | } | ||
1107 | |||
1108 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); | ||
1109 | S32 left = mTextureSizeBarRect.mLeft ; | ||
1110 | S32 bottom = mTextureSizeBarRect.mBottom ; | ||
1111 | S32 right = mTextureSizeBarRect.mRight ; | ||
1112 | S32 top = mTextureSizeBarRect.mTop ; | ||
1113 | |||
1114 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | ||
1115 | |||
1116 | //background rect | ||
1117 | gl_rect_2d(left - 25, top + 30, right + 100, bottom - 25, LLColor4(0.0f, 0.0f, 0.0f, 0.25f)) ; | ||
1118 | |||
1119 | //-------------------------------------------------- | ||
1120 | gGL.color4f(1.0f, 0.5f, 0.5f, 0.75f); | ||
1121 | gl_line_2d(left, bottom, right, bottom) ; //x axis | ||
1122 | gl_line_2d(left, bottom, left, top) ; //y axis | ||
1123 | |||
1124 | //ruler | ||
1125 | //-------------------------------------------------- | ||
1126 | gGL.color4f(1.0f, 0.5f, 0.5f, 0.5f); | ||
1127 | for(S32 i = bottom + 50 ; i <= top ; i += 50) | ||
1128 | { | ||
1129 | gl_line_2d(left, i, right, i) ; | ||
1130 | } | ||
1131 | |||
1132 | //texts | ||
1133 | //-------------------------------------------------- | ||
1134 | F32 text_color[] = {1.f, 1.f, 1.f, 0.75f}; | ||
1135 | std::string text; | ||
1136 | |||
1137 | //------- | ||
1138 | //x axis: size label | ||
1139 | static char category[LLViewerImageBoostLevel::MAX_GL_IMAGE_CATEGORY][4] = | ||
1140 | {"Non", "Bak", "Av", "Cld", "Scp", "Hi", "Trn", "Slt", "Hud", "Bsf", "UI", "Pvw", "Map", "Mvs", "Slf", "Tbp", "Scr", "Fnt", "Bmp", "Dyn", "Tlc", "Mdi", "ALT", "Oth" } ; | ||
1141 | |||
1142 | text = llformat("%s", category[0]) ; | ||
1143 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 12, bottom - line_height / 2, | ||
1144 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1145 | for(U32 i = 1 ; i < mTextureSizeBar.size() ; i++) | ||
1146 | { | ||
1147 | text = llformat("%s", category[i]) ; | ||
1148 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + i * mTextureSizeBarWidth + 12, bottom - line_height / 2, | ||
1149 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1150 | } | ||
1151 | //------- | ||
1152 | |||
1153 | //y axis: number label | ||
1154 | for(S32 i = bottom + 50 ; i <= top ; i += 50) | ||
1155 | { | ||
1156 | text = llformat("%d", (S32)((i - bottom) / scale)) ; | ||
1157 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left - 20, i + line_height / 2 , | ||
1158 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1159 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, right + 5, i + line_height / 2 , | ||
1160 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1161 | } | ||
1162 | |||
1163 | text = llformat("MB") ; | ||
1164 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left - 20, top + line_height * 2 , | ||
1165 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1166 | //-------------------------------------------------- | ||
1167 | F32 loaded_color[] = {1.0f, 0.0f, 0.0f, 0.75f}; | ||
1168 | gl_rect_2d(left + 70, top + line_height * 2, left + 90, top + line_height, loaded_color) ; | ||
1169 | text = llformat("Loaded") ; | ||
1170 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 100, top + line_height * 2, | ||
1171 | loaded_color, | ||
1172 | LLFontGL::LEFT, LLFontGL::TOP); | ||
1173 | |||
1174 | F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f}; | ||
1175 | gl_rect_2d(left + 170, top + line_height * 2, left + 190, top + line_height, bound_color) ; | ||
1176 | text = llformat("Bound") ; | ||
1177 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 200, top + line_height * 2, | ||
1178 | bound_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1179 | |||
1180 | //-------------------------------------------------- | ||
1181 | |||
1182 | //title | ||
1183 | text = llformat("Texture Category Distribution") ; | ||
1184 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 250, top + line_height * 3, | ||
1185 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1186 | |||
1187 | return scale ; | ||
1188 | } | ||
diff --git a/linden/indra/newview/lltextureview.h b/linden/indra/newview/lltextureview.h index f91a296..e95c152 100644 --- a/linden/indra/newview/lltextureview.h +++ b/linden/indra/newview/lltextureview.h | |||
@@ -76,5 +76,40 @@ public: | |||
76 | static std::set<LLViewerImage*> sDebugImages; | 76 | static std::set<LLViewerImage*> sDebugImages; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | class LLGLTexSizeBar; | ||
80 | class LLTextureSizeView : public LLView | ||
81 | { | ||
82 | public: | ||
83 | LLTextureSizeView(const std::string& name); | ||
84 | ~LLTextureSizeView(); | ||
85 | |||
86 | /*virtual*/ void draw(); | ||
87 | /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) ; | ||
88 | |||
89 | void setType(S32 type) {mType = type ;} | ||
90 | enum | ||
91 | { | ||
92 | TEXTURE_MEM_OVER_SIZE, | ||
93 | TEXTURE_MEM_OVER_CATEGORY | ||
94 | }; | ||
95 | private: | ||
96 | //draw background for TEXTURE_MEM_OVER_SIZE | ||
97 | F32 drawTextureSizeDistributionGraph() ; | ||
98 | //draw real-time texture mem bar over size | ||
99 | void drawTextureSizeGraph(); | ||
100 | |||
101 | //draw background for TEXTURE_MEM_OVER_CATEGORY | ||
102 | F32 drawTextureCategoryDistributionGraph() ; | ||
103 | //draw real-time texture mem bar over category | ||
104 | void drawTextureCategoryGraph(); | ||
105 | |||
106 | private: | ||
107 | std::vector<LLGLTexSizeBar*> mTextureSizeBar ; | ||
108 | LLRect mTextureSizeBarRect ; | ||
109 | S32 mTextureSizeBarWidth ; | ||
110 | S32 mType ; | ||
111 | }; | ||
79 | extern LLTextureView *gTextureView; | 112 | extern LLTextureView *gTextureView; |
113 | extern LLTextureSizeView *gTextureSizeView; | ||
114 | extern LLTextureSizeView *gTextureCategoryView; | ||
80 | #endif // LL_TEXTURE_VIEW_H | 115 | #endif // LL_TEXTURE_VIEW_H |
diff --git a/linden/indra/newview/llviewerstats.cpp b/linden/indra/newview/llviewerstats.cpp index d12d51c..93e69ca 100644 --- a/linden/indra/newview/llviewerstats.cpp +++ b/linden/indra/newview/llviewerstats.cpp | |||
@@ -501,12 +501,18 @@ extern U32 gVisCompared; | |||
501 | extern U32 gVisTested; | 501 | extern U32 gVisTested; |
502 | 502 | ||
503 | std::map<S32,LLFrameTimer> gDebugTimers; | 503 | std::map<S32,LLFrameTimer> gDebugTimers; |
504 | std::map<S32,std::string> gDebugTimerLabel; | ||
505 | |||
506 | void init_statistics() | ||
507 | { | ||
508 | // Label debug timers | ||
509 | gDebugTimerLabel[0] = "Texture"; | ||
510 | } | ||
504 | 511 | ||
505 | void update_statistics(U32 frame_count) | 512 | void update_statistics(U32 frame_count) |
506 | { | 513 | { |
507 | gTotalWorldBytes += gVLManager.getTotalBytes(); | 514 | gTotalWorldBytes += gVLManager.getTotalBytes(); |
508 | gTotalObjectBytes += gObjectBits / 8; | 515 | gTotalObjectBytes += gObjectBits / 8; |
509 | gTotalTextureBytes += LLViewerImageList::sTextureBits / 8; | ||
510 | 516 | ||
511 | // make sure we have a valid time delta for this frame | 517 | // make sure we have a valid time delta for this frame |
512 | if (gFrameIntervalSeconds > 0.f) | 518 | if (gFrameIntervalSeconds > 0.f) |
@@ -558,7 +564,6 @@ void update_statistics(U32 frame_count) | |||
558 | F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits()); | 564 | F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits()); |
559 | LLViewerStats::getInstance()->mLayersKBitStat.addValue(layer_bits/1024.f); | 565 | LLViewerStats::getInstance()->mLayersKBitStat.addValue(layer_bits/1024.f); |
560 | LLViewerStats::getInstance()->mObjectKBitStat.addValue(gObjectBits/1024.f); | 566 | LLViewerStats::getInstance()->mObjectKBitStat.addValue(gObjectBits/1024.f); |
561 | LLViewerStats::getInstance()->mTextureKBitStat.addValue(LLViewerImageList::sTextureBits/1024.f); | ||
562 | LLViewerStats::getInstance()->mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending()); | 567 | LLViewerStats::getInstance()->mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending()); |
563 | LLViewerStats::getInstance()->mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); | 568 | LLViewerStats::getInstance()->mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); |
564 | gTransferManager.resetTransferBitsIn(LLTCT_ASSET); | 569 | gTransferManager.resetTransferBitsIn(LLTCT_ASSET); |
@@ -572,8 +577,6 @@ void update_statistics(U32 frame_count) | |||
572 | gDebugTimers[0].unpause(); | 577 | gDebugTimers[0].unpause(); |
573 | } | 578 | } |
574 | 579 | ||
575 | LLViewerStats::getInstance()->mTexturePacketsStat.addValue(LLViewerImageList::sTexturePackets); | ||
576 | |||
577 | { | 580 | { |
578 | static F32 visible_avatar_frames = 0.f; | 581 | static F32 visible_avatar_frames = 0.f; |
579 | static F32 avg_visible_avatars = 0; | 582 | static F32 avg_visible_avatars = 0; |
@@ -593,8 +596,20 @@ void update_statistics(U32 frame_count) | |||
593 | gObjectBits = 0; | 596 | gObjectBits = 0; |
594 | // gDecodedBits = 0; | 597 | // gDecodedBits = 0; |
595 | 598 | ||
596 | LLViewerImageList::sTextureBits = 0; | 599 | // Only update texture stats ones per second so that they are less noisy |
597 | LLViewerImageList::sTexturePackets = 0; | 600 | { |
601 | static const F32 texture_stats_freq = 1.f; | ||
602 | static LLFrameTimer texture_stats_timer; | ||
603 | if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq) | ||
604 | { | ||
605 | LLViewerStats::getInstance()->mTextureKBitStat.addValue(LLViewerImageList::sTextureBits/1024.f); | ||
606 | LLViewerStats::getInstance()->mTexturePacketsStat.addValue(LLViewerImageList::sTexturePackets); | ||
607 | gTotalTextureBytes += LLViewerImageList::sTextureBits / 8; | ||
608 | LLViewerImageList::sTextureBits = 0; | ||
609 | LLViewerImageList::sTexturePackets = 0; | ||
610 | texture_stats_timer.reset(); | ||
611 | } | ||
612 | } | ||
598 | 613 | ||
599 | #if LL_LCD_COMPILE | 614 | #if LL_LCD_COMPILE |
600 | bool LCDenabled = gLcdScreen->Enabled(); | 615 | bool LCDenabled = gLcdScreen->Enabled(); |
@@ -775,3 +790,4 @@ void send_stats() | |||
775 | LLViewerStats::getInstance()->addToMessage(body); | 790 | LLViewerStats::getInstance()->addToMessage(body); |
776 | LLHTTPClient::post(url, body, new ViewerStatsResponder()); | 791 | LLHTTPClient::post(url, body, new ViewerStatsResponder()); |
777 | } | 792 | } |
793 | |||
diff --git a/linden/indra/newview/llviewerstats.h b/linden/indra/newview/llviewerstats.h index d3fd4f2..b176632 100644 --- a/linden/indra/newview/llviewerstats.h +++ b/linden/indra/newview/llviewerstats.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #define LL_LLVIEWERSTATS_H | 34 | #define LL_LLVIEWERSTATS_H |
35 | 35 | ||
36 | #include "llstat.h" | 36 | #include "llstat.h" |
37 | #include "lltextureinfo.h" | ||
37 | 38 | ||
38 | class LLViewerStats : public LLSingleton<LLViewerStats> | 39 | class LLViewerStats : public LLSingleton<LLViewerStats> |
39 | { | 40 | { |
@@ -198,10 +199,13 @@ private: | |||
198 | static const F32 SEND_STATS_PERIOD = 300.0f; | 199 | static const F32 SEND_STATS_PERIOD = 300.0f; |
199 | 200 | ||
200 | // The following are from (older?) statistics code found in appviewer. | 201 | // The following are from (older?) statistics code found in appviewer. |
202 | void init_statistics(); | ||
201 | void reset_statistics(); | 203 | void reset_statistics(); |
202 | void output_statistics(void*); | 204 | void output_statistics(void*); |
203 | void update_statistics(U32 frame_count); | 205 | void update_statistics(U32 frame_count); |
204 | void send_stats(); | 206 | void send_stats(); |
205 | 207 | ||
206 | extern std::map<S32,LLFrameTimer> gDebugTimers; | 208 | extern std::map<S32,LLFrameTimer> gDebugTimers; |
209 | extern std::map<S32,std::string> gDebugTimerLabel; | ||
210 | |||
207 | #endif // LL_LLVIEWERSTATS_H | 211 | #endif // LL_LLVIEWERSTATS_H |