From c180fe2ae2b5d2e00149f9902717e02ed7042143 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 19 Nov 2012 22:28:12 -0700 Subject: for SH-3561: capture the frame buffer contents and compare pixel differences between frames. --- indra/newview/llscenemonitor.cpp | 358 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 358 insertions(+) create mode 100644 indra/newview/llscenemonitor.cpp (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp new file mode 100644 index 0000000000..8597767c61 --- /dev/null +++ b/indra/newview/llscenemonitor.cpp @@ -0,0 +1,358 @@ +/** + * @file llscenemonitor.cpp + * @brief monitor the scene loading process. + * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llrendertarget.h" +#include "llscenemonitor.h" +#include "llviewerwindow.h" +#include "llviewerdisplay.h" +#include "llviewercontrol.h" +#include "llviewershadermgr.h" +#include "llui.h" +#include "llstartup.h" +#include "llappviewer.h" +#include "llwindow.h" +#include "llpointer.h" + +LLSceneMonitorView* gSceneMonitorView = NULL; + +LLSceneMonitor::LLSceneMonitor() : mEnabled(false), mDiff(NULL), mNeedsUpdateDiff(FALSE) +{ + mFrames[0] = NULL; + mFrames[1] = NULL; +} + +LLSceneMonitor::~LLSceneMonitor() +{ + destroyClass(); +} + +void LLSceneMonitor::destroyClass() +{ + reset(); +} + +void LLSceneMonitor::reset() +{ + delete mFrames[0]; + delete mFrames[1]; + delete mDiff; + + mFrames[0] = NULL; + mFrames[1] = NULL; + mDiff = NULL; +} + +void LLSceneMonitor::setEnabled(bool enabled) +{ + if(enabled == (bool)gSavedSettings.getBOOL("SceneLoadingMonitorEnabled")) + { + return; + } + gSavedSettings.setBOOL("SceneLoadingMonitorEnabled", enabled); +} + +bool LLSceneMonitor::preCapture() +{ + static LLCachedControl enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); + static LLFrameTimer timer; + + mCurTarget = NULL; + if (!LLGLSLShader::sNoFixedFunction) + { + return false; + } + if(mEnabled != (BOOL)enabled) + { + if(mEnabled) + { + reset(); + unfreezeScene(); + } + else + { + freezeScene(); + } + + mEnabled = (BOOL)enabled; + } + + if(!mEnabled) + { + return false; + } + + if (LLStartUp::getStartupState() < STATE_STARTED) + { + return false; + } + + if(LLAppViewer::instance()->logoutRequestSent()) + { + return false; + } + + if(gWindowResized || gHeadlessClient || gTeleportDisplay || gRestoreGL || gDisconnected) + { + return false; + } + + if ( !gViewerWindow->getActive() + || !gViewerWindow->getWindow()->getVisible() + || gViewerWindow->getWindow()->getMinimized() ) + { + return false; + } + + if(timer.getElapsedTimeF32() < 1.0f) + { + return false; + } + timer.reset(); + + S32 width = gViewerWindow->getWorldViewWidthRaw(); + S32 height = gViewerWindow->getWorldViewHeightRaw(); + + if(!mFrames[0]) + { + mFrames[0] = new LLRenderTarget(); + mFrames[0]->allocate(width, height, GL_RGB, false, false, LLTexUnit::TT_TEXTURE, true); + gGL.getTexUnit(0)->bind(mFrames[0]); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + mCurTarget = mFrames[0]; + } + else if(!mFrames[1]) + { + mFrames[1] = new LLRenderTarget(); + mFrames[1]->allocate(width, height, GL_RGB, false, false, LLTexUnit::TT_TEXTURE, true); + gGL.getTexUnit(0)->bind(mFrames[1]); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + mCurTarget = mFrames[1]; + } + else //swap + { + mCurTarget = mFrames[0]; + mFrames[0] = mFrames[1]; + mFrames[1] = mCurTarget; + } + + if(mCurTarget->getWidth() != width || mCurTarget->getHeight() != height) //size changed + { + mCurTarget->resize(width, height, GL_RGB); + } + + return true; +} + +void LLSceneMonitor::postCapture() +{ + mCurTarget = NULL; + mNeedsUpdateDiff = TRUE; +} + +void LLSceneMonitor::freezeAvatar(LLCharacter* avatarp) +{ + mAvatarPauseHandles.push_back(avatarp->requestPause()); +} + +void LLSceneMonitor::freezeScene() +{ + //freeze all avatars + for (std::vector::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + freezeAvatar((LLCharacter*)(*iter)); + } + + // freeze everything else + gSavedSettings.setBOOL("FreezeTime", TRUE); +} + +void LLSceneMonitor::unfreezeScene() +{ + //thaw all avatars + mAvatarPauseHandles.clear(); + + // thaw everything else + gSavedSettings.setBOOL("FreezeTime", FALSE); +} + +LLRenderTarget* LLSceneMonitor::getDiffTarget() const +{ + return mDiff; +} + +void LLSceneMonitor::capture() +{ + static U32 count = 0; + if(count == gFrameCount) + { + return; + } + count = gFrameCount; + + preCapture(); + + if(!mCurTarget) + { + return; + } + + U32 old_FBO = LLRenderTarget::sCurFBO; + + gGL.getTexUnit(0)->bind(mCurTarget); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); //point to the main frame buffer. + + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, mCurTarget->getWidth(), mCurTarget->getHeight()); //copy the content + + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, old_FBO); + + postCapture(); +} + +void LLSceneMonitor::compare() +{ + if(!mNeedsUpdateDiff) + { + return; + } + + if(!mFrames[0] || !mFrames[1]) + { + return; + } + if(mFrames[0]->getWidth() != mFrames[1]->getWidth() || mFrames[0]->getHeight() != mFrames[1]->getHeight()) + { + return; //size does not match + } + + if (!LLGLSLShader::sNoFixedFunction) + { + return; + } + + S32 width = mFrames[0]->getWidth(); + S32 height = mFrames[0]->getHeight(); + if(!mDiff) + { + mDiff = new LLRenderTarget(); + mDiff->allocate(width, height, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true); + } + else if(mDiff->getWidth() != width || mDiff->getHeight() != height) + { + mDiff->resize(width, height, GL_RGBA); + } + mDiff->bindTarget(); + mDiff->clear(); + + gTwoTextureCompareProgram.bind(); + + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->bind(mFrames[0]); + gGL.getTexUnit(0)->activate(); + + gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->bind(mFrames[1]); + gGL.getTexUnit(1)->activate(); + + gl_rect_2d_simple_tex(width, height); + + gGL.flush(); + mDiff->flush(); + + gTwoTextureCompareProgram.unbind(); + + gGL.getTexUnit(0)->disable(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + + mNeedsUpdateDiff = FALSE; +} + +//------------------------------------------------------------------------------------------------------------- +//definition of class LLSceneMonitorView +//------------------------------------------------------------------------------------------------------------- +LLSceneMonitorView::LLSceneMonitorView(const LLRect& rect) + : LLFloater(LLSD()) +{ + setRect(rect); + setVisible(FALSE); + + setCanMinimize(false); + setCanClose(true); +} + +void LLSceneMonitorView::onClickCloseBtn() +{ + setVisible(false); +} + +void LLSceneMonitorView::setVisible(BOOL visible) +{ + if(visible != (BOOL)LLSceneMonitor::getInstance()->isEnabled()) + { + LLSceneMonitor::getInstance()->setEnabled(visible); + } + + LLView::setVisible(visible); +} + +void LLSceneMonitorView::draw() +{ + if (!LLGLSLShader::sNoFixedFunction) + { + return; + } + LLRenderTarget* target = LLSceneMonitor::getInstance()->getDiffTarget(); + if(!target) + { + return; + } + + S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f); + S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f); + + LLRect new_rect; + new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); + setRect(new_rect); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + + gl_draw_scaled_target(0, 0, getRect().getWidth(), getRect().getHeight(), target);//, LLColor4(0.f, 0.f, 0.f, 0.25f)); + + LLView::draw(); +} + -- cgit v1.2.3 From 6ae6abae26200c80a15d2e2d899ae6970602ff04 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 21 Nov 2012 13:29:15 -0700 Subject: more for SH-3571: display frame-to-frame pixel differences on screen --- indra/newview/llscenemonitor.cpp | 43 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 8597767c61..0730281d85 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -39,7 +39,12 @@ LLSceneMonitorView* gSceneMonitorView = NULL; -LLSceneMonitor::LLSceneMonitor() : mEnabled(false), mDiff(NULL), mNeedsUpdateDiff(FALSE) +LLSceneMonitor::LLSceneMonitor() : + mEnabled(FALSE), + mDiff(NULL), + mCurTarget(NULL), + mNeedsUpdateDiff(FALSE), + mDebugViewerVisible(FALSE) { mFrames[0] = NULL; mFrames[1] = NULL; @@ -66,18 +71,14 @@ void LLSceneMonitor::reset() mDiff = NULL; } -void LLSceneMonitor::setEnabled(bool enabled) +void LLSceneMonitor::setDebugViewerVisible(BOOL visible) { - if(enabled == (bool)gSavedSettings.getBOOL("SceneLoadingMonitorEnabled")) - { - return; - } - gSavedSettings.setBOOL("SceneLoadingMonitorEnabled", enabled); + mDebugViewerVisible = visible; } bool LLSceneMonitor::preCapture() { - static LLCachedControl enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); + static LLCachedControl monitor_enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); static LLFrameTimer timer; mCurTarget = NULL; @@ -85,7 +86,9 @@ bool LLSceneMonitor::preCapture() { return false; } - if(mEnabled != (BOOL)enabled) + + BOOL enabled = (BOOL)monitor_enabled || mDebugViewerVisible; + if(mEnabled != enabled) { if(mEnabled) { @@ -97,7 +100,7 @@ bool LLSceneMonitor::preCapture() freezeScene(); } - mEnabled = (BOOL)enabled; + mEnabled = enabled; } if(!mEnabled) @@ -260,8 +263,8 @@ void LLSceneMonitor::compare() return; } - S32 width = mFrames[0]->getWidth(); - S32 height = mFrames[0]->getHeight(); + S32 width = gViewerWindow->getWindowWidthRaw(); + S32 height = gViewerWindow->getWindowHeightRaw(); if(!mDiff) { mDiff = new LLRenderTarget(); @@ -288,7 +291,6 @@ void LLSceneMonitor::compare() gl_rect_2d_simple_tex(width, height); - gGL.flush(); mDiff->flush(); gTwoTextureCompareProgram.unbind(); @@ -321,10 +323,7 @@ void LLSceneMonitorView::onClickCloseBtn() void LLSceneMonitorView::setVisible(BOOL visible) { - if(visible != (BOOL)LLSceneMonitor::getInstance()->isEnabled()) - { - LLSceneMonitor::getInstance()->setEnabled(visible); - } + LLSceneMonitor::getInstance()->setDebugViewerVisible(visible); LLView::setVisible(visible); } @@ -341,17 +340,17 @@ void LLSceneMonitorView::draw() return; } - S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f); - S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f); + S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.5f); + S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.5f); LLRect new_rect; new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); setRect(new_rect); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + //gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); - gl_draw_scaled_target(0, 0, getRect().getWidth(), getRect().getHeight(), target);//, LLColor4(0.f, 0.f, 0.f, 0.25f)); + gl_draw_scaled_target(0, 0, getRect().getWidth(), getRect().getHeight(), target); LLView::draw(); } -- cgit v1.2.3 From 21409a3aaaef71102195d65fc35cebdb5d941a26 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 30 Nov 2012 22:50:06 -0700 Subject: for SH-3350 and SH-3353: Report frame-to-frame visual deltas as an LLStat --- indra/newview/llscenemonitor.cpp | 188 ++++++++++++++++++++++++++------------- 1 file changed, 127 insertions(+), 61 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 0730281d85..adeada04ca 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -36,18 +36,24 @@ #include "llappviewer.h" #include "llwindow.h" #include "llpointer.h" +#include "llspatialpartition.h" LLSceneMonitorView* gSceneMonitorView = NULL; LLSceneMonitor::LLSceneMonitor() : mEnabled(FALSE), - mDiff(NULL), + mDiff(NULL), + mDiffResult(0.f), + mDiffTolerance(0.1f), mCurTarget(NULL), - mNeedsUpdateDiff(FALSE), - mDebugViewerVisible(FALSE) + mNeedsUpdateDiff(FALSE), + mHasNewDiff(FALSE), + mHasNewQueryResult(FALSE), + mDebugViewerVisible(FALSE), + mQueryObject(0) { mFrames[0] = NULL; - mFrames[1] = NULL; + mFrames[1] = NULL; } LLSceneMonitor::~LLSceneMonitor() @@ -69,6 +75,15 @@ void LLSceneMonitor::reset() mFrames[0] = NULL; mFrames[1] = NULL; mDiff = NULL; + mCurTarget = NULL; + + unfreezeScene(); + + if(mQueryObject > 0) + { + release_occlusion_query_object_name(mQueryObject); + mQueryObject = 0; + } } void LLSceneMonitor::setDebugViewerVisible(BOOL visible) @@ -108,28 +123,6 @@ bool LLSceneMonitor::preCapture() return false; } - if (LLStartUp::getStartupState() < STATE_STARTED) - { - return false; - } - - if(LLAppViewer::instance()->logoutRequestSent()) - { - return false; - } - - if(gWindowResized || gHeadlessClient || gTeleportDisplay || gRestoreGL || gDisconnected) - { - return false; - } - - if ( !gViewerWindow->getActive() - || !gViewerWindow->getWindow()->getVisible() - || gViewerWindow->getWindow()->getMinimized() ) - { - return false; - } - if(timer.getElapsedTimeF32() < 1.0f) { return false; @@ -174,12 +167,6 @@ bool LLSceneMonitor::preCapture() return true; } -void LLSceneMonitor::postCapture() -{ - mCurTarget = NULL; - mNeedsUpdateDiff = TRUE; -} - void LLSceneMonitor::freezeAvatar(LLCharacter* avatarp) { mAvatarPauseHandles.push_back(avatarp->requestPause()); @@ -207,19 +194,14 @@ void LLSceneMonitor::unfreezeScene() gSavedSettings.setBOOL("FreezeTime", FALSE); } -LLRenderTarget* LLSceneMonitor::getDiffTarget() const -{ - return mDiff; -} - void LLSceneMonitor::capture() { - static U32 count = 0; - if(count == gFrameCount) + static U32 last_capture_time = 0; + if(last_capture_time == gFrameCount) { return; } - count = gFrameCount; + last_capture_time = gFrameCount; preCapture(); @@ -239,7 +221,8 @@ void LLSceneMonitor::capture() glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, old_FBO); - postCapture(); + mCurTarget = NULL; + mNeedsUpdateDiff = TRUE; } void LLSceneMonitor::compare() @@ -248,6 +231,7 @@ void LLSceneMonitor::compare() { return; } + mNeedsUpdateDiff = FALSE; if(!mFrames[0] || !mFrames[1]) { @@ -258,11 +242,6 @@ void LLSceneMonitor::compare() return; //size does not match } - if (!LLGLSLShader::sNoFixedFunction) - { - return; - } - S32 width = gViewerWindow->getWindowWidthRaw(); S32 height = gViewerWindow->getWindowHeightRaw(); if(!mDiff) @@ -274,9 +253,10 @@ void LLSceneMonitor::compare() { mDiff->resize(width, height, GL_RGBA); } + mDiff->bindTarget(); mDiff->clear(); - + gTwoTextureCompareProgram.bind(); gGL.getTexUnit(0)->activate(); @@ -288,21 +268,108 @@ void LLSceneMonitor::compare() gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->bind(mFrames[1]); gGL.getTexUnit(1)->activate(); - + gl_rect_2d_simple_tex(width, height); - mDiff->flush(); + mDiff->flush(); gTwoTextureCompareProgram.unbind(); - + gGL.getTexUnit(0)->disable(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - mNeedsUpdateDiff = FALSE; + mHasNewDiff = TRUE; + + //send out the query request. + queryDiff(); +} + +void LLSceneMonitor::queryDiff() +{ + if(mDebugViewerVisible) + { + return; + } + + calcDiffAggregate(); +} + +//calculate Diff aggregate information in GPU, and enable gl occlusion query to capture it. +void LLSceneMonitor::calcDiffAggregate() +{ + if(!mHasNewDiff && !mDebugViewerVisible) + { + return; + } + + if(!mQueryObject) + { + mQueryObject = get_new_occlusion_query_object_name(); + } + + LLGLDepthTest depth(true, false, GL_ALWAYS); + if(!mDebugViewerVisible) + { + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + } + + LLGLSLShader* cur_shader = NULL; + + cur_shader = LLGLSLShader::sCurBoundShaderPtr; + gOneTextureFilterProgram.bind(); + gOneTextureFilterProgram.uniform1f("tolerance", mDiffTolerance); + + if(mHasNewDiff) + { + glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mQueryObject); + } + + gl_draw_scaled_target(0, 0, mDiff->getWidth() * 0.5f, mDiff->getHeight() * 0.5f, mDiff); + + if(mHasNewDiff) + { + glEndQueryARB(GL_SAMPLES_PASSED_ARB); + mHasNewDiff = FALSE; + mHasNewQueryResult = TRUE; + } + + gOneTextureFilterProgram.unbind(); + + if(cur_shader != NULL) + { + cur_shader->bind(); + } + + if(!mDebugViewerVisible) + { + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + } } +void LLSceneMonitor::fetchQueryResult() +{ + if(!mHasNewQueryResult) + { + return; + } + mHasNewQueryResult = FALSE; + + GLuint available = 0; + glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available); + if(!available) + { + return; + } + + GLuint count = 0; + glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); + + mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * 0.25f); + + //llinfos << count << " : " << mDiffResult << llendl; +} //------------------------------------------------------------------------------------------------------------- //definition of class LLSceneMonitorView //------------------------------------------------------------------------------------------------------------- @@ -330,27 +397,26 @@ void LLSceneMonitorView::setVisible(BOOL visible) void LLSceneMonitorView::draw() { - if (!LLGLSLShader::sNoFixedFunction) - { - return; - } - LLRenderTarget* target = LLSceneMonitor::getInstance()->getDiffTarget(); + const LLRenderTarget* target = LLSceneMonitor::getInstance()->getDiffTarget(); if(!target) { return; } - S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.5f); - S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.5f); + S32 height = target->getHeight() * 0.5f; + S32 width = target->getWidth() * 0.5f; + //S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.5f); + //S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.5f); LLRect new_rect; new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); setRect(new_rect); - //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - //gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + //draw background + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); - gl_draw_scaled_target(0, 0, getRect().getWidth(), getRect().getHeight(), target); + LLSceneMonitor::getInstance()->calcDiffAggregate(); LLView::draw(); } -- cgit v1.2.3 From 0270ce079c2090cd25244516648ac1691db00a0d Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Sun, 2 Dec 2012 22:12:43 -0700 Subject: more for SH-3350, add debug texts --- indra/newview/llscenemonitor.cpp | 43 ++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index adeada04ca..43f9e9208b 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -40,6 +40,18 @@ LLSceneMonitorView* gSceneMonitorView = NULL; +// +//The procedures of monitoring when the scene finishes loading visually, +//i.e., no pixel differences among frames, are: +//1, freeze all dynamic objects and avatars; +//2, (?) disable all sky and water; +//3, capture frames periodically, by calling "capture()"; +//4, compute pixel differences between two latest captured frames, by calling "compare()", results are stored at mDiff; +//5, compute the number of pixels in mDiff above some tolerance threshold in GPU, by calling "queryDiff() -> calcDiffAggregate()"; +//6, use gl occlusion query to fetch the result from GPU, by calling "fetchQueryResult()"; +//END. +// + LLSceneMonitor::LLSceneMonitor() : mEnabled(FALSE), mDiff(NULL), @@ -50,7 +62,9 @@ LLSceneMonitor::LLSceneMonitor() : mHasNewDiff(FALSE), mHasNewQueryResult(FALSE), mDebugViewerVisible(FALSE), - mQueryObject(0) + mQueryObject(0), + mSamplingTime(1.0f), + mDiffPixelRatio(0.5f) { mFrames[0] = NULL; mFrames[1] = NULL; @@ -123,7 +137,7 @@ bool LLSceneMonitor::preCapture() return false; } - if(timer.getElapsedTimeF32() < 1.0f) + if(timer.getElapsedTimeF32() < mSamplingTime) { return false; } @@ -326,7 +340,7 @@ void LLSceneMonitor::calcDiffAggregate() glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mQueryObject); } - gl_draw_scaled_target(0, 0, mDiff->getWidth() * 0.5f, mDiff->getHeight() * 0.5f, mDiff); + gl_draw_scaled_target(0, 0, mDiff->getWidth() * mDiffPixelRatio, mDiff->getHeight() * mDiffPixelRatio, mDiff); if(mHasNewDiff) { @@ -366,7 +380,7 @@ void LLSceneMonitor::fetchQueryResult() GLuint count = 0; glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); - mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * 0.25f); + mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) //llinfos << count << " : " << mDiffResult << llendl; } @@ -403,8 +417,9 @@ void LLSceneMonitorView::draw() return; } - S32 height = target->getHeight() * 0.5f; - S32 width = target->getWidth() * 0.5f; + F32 ratio = LLSceneMonitor::getInstance()->getDiffPixelRatio(); + S32 height = target->getHeight() * ratio; + S32 width = target->getWidth() * ratio; //S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.5f); //S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.5f); @@ -418,6 +433,22 @@ void LLSceneMonitorView::draw() LLSceneMonitor::getInstance()->calcDiffAggregate(); + //show some texts + LLColor4 color = LLColor4::white; + S32 line_height = LLFontGL::getFontMonospace()->getLineHeight(); + + S32 lines = 0; + std::string num_str = llformat("Frame difference: %.6f", LLSceneMonitor::getInstance()->getDiffResult()); + LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; + + num_str = llformat("Pixel tolerance: (R+G+B) < %.4f", LLSceneMonitor::getInstance()->getDiffTolerance()); + LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; + + num_str = llformat("Sampling time: %.3f seconds", LLSceneMonitor::getInstance()->getSamplingTime()); + LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + LLView::draw(); } -- cgit v1.2.3 From 1fbd45672fcb1e5bfc194712fc7d0d4847a651cd Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 19 Dec 2012 23:21:31 -0700 Subject: fix for SH-3640: Can not edit objects --- indra/newview/llscenemonitor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 43f9e9208b..4872200f24 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -211,6 +211,7 @@ void LLSceneMonitor::unfreezeScene() void LLSceneMonitor::capture() { static U32 last_capture_time = 0; + if(last_capture_time == gFrameCount) { return; @@ -239,6 +240,11 @@ void LLSceneMonitor::capture() mNeedsUpdateDiff = TRUE; } +bool LLSceneMonitor::needsUpdate() const +{ + return mNeedsUpdateDiff; +} + void LLSceneMonitor::compare() { if(!mNeedsUpdateDiff) -- cgit v1.2.3 From 840540be186904b1e711d79dede0c771c967950c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 10 Jan 2013 18:42:39 -0800 Subject: SH-3405 WIP convert existing stats to lltrace system fixed gcc errors in llscenemonitor.cpp --- indra/newview/llscenemonitor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 4872200f24..189697dcf0 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -346,7 +346,7 @@ void LLSceneMonitor::calcDiffAggregate() glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mQueryObject); } - gl_draw_scaled_target(0, 0, mDiff->getWidth() * mDiffPixelRatio, mDiff->getHeight() * mDiffPixelRatio, mDiff); + gl_draw_scaled_target(0, 0, S32(mDiff->getWidth() * mDiffPixelRatio), S32(mDiff->getHeight() * mDiffPixelRatio), mDiff); if(mHasNewDiff) { @@ -424,8 +424,8 @@ void LLSceneMonitorView::draw() } F32 ratio = LLSceneMonitor::getInstance()->getDiffPixelRatio(); - S32 height = target->getHeight() * ratio; - S32 width = target->getWidth() * ratio; + S32 height = (S32)(target->getHeight() * ratio); + S32 width = (S32)(target->getWidth() * ratio); //S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.5f); //S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.5f); -- cgit v1.2.3 From ba54846697aded3a19cb91d53436d3ab26fa0aed Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 14 Mar 2013 20:54:28 -0600 Subject: for SH-3968: Rendering issues when scene loading monitoring code disabled on Mac. --- indra/newview/llscenemonitor.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 189697dcf0..82ab90e325 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -410,6 +410,7 @@ void LLSceneMonitorView::onClickCloseBtn() void LLSceneMonitorView::setVisible(BOOL visible) { + visible = visible && LLGLSLShader::sNoFixedFunction; LLSceneMonitor::getInstance()->setDebugViewerVisible(visible); LLView::setVisible(visible); -- cgit v1.2.3 From 1f507c3cfca0c7722ebeaf71883fbaa83988e1a9 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 21 Mar 2013 00:37:20 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics copied over scene load frame differencing changes from viewer-interesting made periodicrecording flexible enough to allow for indefinite number of periods added scene loading stats floater fixed collapsing behavior of container views --- indra/newview/llscenemonitor.cpp | 108 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 189697dcf0..c69f276aa2 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -37,6 +37,8 @@ #include "llwindow.h" #include "llpointer.h" #include "llspatialpartition.h" +#include "llagent.h" +#include "pipeline.h" LLSceneMonitorView* gSceneMonitorView = NULL; @@ -67,7 +69,10 @@ LLSceneMonitor::LLSceneMonitor() : mDiffPixelRatio(0.5f) { mFrames[0] = NULL; - mFrames[1] = NULL; + mFrames[1] = NULL; + + mRecording = new LLTrace::ExtendableRecording(); + mRecording->start(); } LLSceneMonitor::~LLSceneMonitor() @@ -78,6 +83,10 @@ LLSceneMonitor::~LLSceneMonitor() void LLSceneMonitor::destroyClass() { reset(); + + delete mRecording; + mRecording = NULL; + mDitheringTexture = NULL; } void LLSceneMonitor::reset() @@ -100,6 +109,67 @@ void LLSceneMonitor::reset() } } +void LLSceneMonitor::generateDitheringTexture(S32 width, S32 height) +{ +#if 1 + //4 * 4 matrix + mDitherMatrixWidth = 4; + S32 dither_matrix[4][4] = + { + {1, 9, 3, 11}, + {13, 5, 15, 7}, + {4, 12, 2, 10}, + {16, 8, 14, 6} + }; + + mDitherScale = 255.f / 17; +#else + //8 * 8 matrix + mDitherMatrixWidth = 16; + S32 dither_matrix[16][16] = + { + {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64}, + {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32}, + {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56}, + {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24}, + {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62}, + {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30}, + {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54}, + {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22}, + {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64}, + {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32}, + {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56}, + {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24}, + {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62}, + {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30}, + {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54}, + {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22} + }; + + mDitherScale = 255.f / 65; +#endif + + LLPointer image_raw = new LLImageRaw(mDitherMatrixWidth, mDitherMatrixWidth, 3); + U8* data = image_raw->getData(); + for (S32 i = 0; i < mDitherMatrixWidth; i++) + { + for (S32 j = 0; j < mDitherMatrixWidth; j++) + { + U8 val = dither_matrix[i][j]; + *data++ = val; + *data++ = val; + *data++ = val; + } + } + + mDitheringTexture = LLViewerTextureManager::getLocalTexture(image_raw.get(), FALSE) ; + mDitheringTexture->setAddressMode(LLTexUnit::TAM_WRAP); + mDitheringTexture->setFilteringOption(LLTexUnit::TFO_POINT); + + mDitherScaleS = (F32)width / mDitherMatrixWidth; + mDitherScaleT = (F32)height / mDitherMatrixWidth; +} + void LLSceneMonitor::setDebugViewerVisible(BOOL visible) { mDebugViewerVisible = visible; @@ -137,6 +207,11 @@ bool LLSceneMonitor::preCapture() return false; } + if(gAgent.isPositionChanged()) + { + mRecording->reset(); + } + if(timer.getElapsedTimeF32() < mSamplingTime) { return false; @@ -197,6 +272,9 @@ void LLSceneMonitor::freezeScene() // freeze everything else gSavedSettings.setBOOL("FreezeTime", TRUE); + + gPipeline.clearRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); } void LLSceneMonitor::unfreezeScene() @@ -206,6 +284,9 @@ void LLSceneMonitor::unfreezeScene() // thaw everything else gSavedSettings.setBOOL("FreezeTime", FALSE); + + gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); } void LLSceneMonitor::capture() @@ -268,10 +349,13 @@ void LLSceneMonitor::compare() { mDiff = new LLRenderTarget(); mDiff->allocate(width, height, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true); + + generateDitheringTexture(width, height); } else if(mDiff->getWidth() != width || mDiff->getHeight() != height) { mDiff->resize(width, height, GL_RGBA); + generateDitheringTexture(width, height); } mDiff->bindTarget(); @@ -279,6 +363,10 @@ void LLSceneMonitor::compare() gTwoTextureCompareProgram.bind(); + gTwoTextureCompareProgram.uniform1f("dither_scale", mDitherScale); + gTwoTextureCompareProgram.uniform1f("dither_scale_s", mDitherScaleS); + gTwoTextureCompareProgram.uniform1f("dither_scale_t", mDitherScaleT); + gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->bind(mFrames[0]); @@ -289,6 +377,11 @@ void LLSceneMonitor::compare() gGL.getTexUnit(1)->bind(mFrames[1]); gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(2)->activate(); + gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->bind(mDitheringTexture); + gGL.getTexUnit(2)->activate(); + gl_rect_2d_simple_tex(width, height); mDiff->flush(); @@ -299,6 +392,8 @@ void LLSceneMonitor::compare() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->disable(); + gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); mHasNewDiff = TRUE; @@ -368,6 +463,7 @@ void LLSceneMonitor::calcDiffAggregate() } } +static LLTrace::MeasurementStatHandle<> sFramePixelDiff("FramePixelDifference"); void LLSceneMonitor::fetchQueryResult() { if(!mHasNewQueryResult) @@ -388,6 +484,11 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) + if(mDiffResult > 0.01f) + { + mRecording->extend(); + sample(sFramePixelDiff, mDiffResult); + } //llinfos << count << " : " << mDiffResult << llendl; } //------------------------------------------------------------------------------------------------------------- @@ -454,6 +555,11 @@ void LLSceneMonitorView::draw() num_str = llformat("Sampling time: %.3f seconds", LLSceneMonitor::getInstance()->getSamplingTime()); LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; + + num_str = llformat("Scene Loading time: %.3f seconds", (F32)LLSceneMonitor::getInstance()->getRecording()->getAcceptedRecording().getDuration().value()); + LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; LLView::draw(); } -- cgit v1.2.3 From 268ea2902d1108a1b30909340ca10ee0bea9f147 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 25 Mar 2013 21:23:59 -0600 Subject: for SH-3833: dump frame diff values from the scene loading monitor to a log file --- indra/newview/llscenemonitor.cpp | 41 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 0145f6f37e..5cde573855 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -486,11 +486,46 @@ void LLSceneMonitor::fetchQueryResult() if(mDiffResult > 0.01f) { - mRecording->extend(); - sample(sFramePixelDiff, mDiffResult); + addMonitorResult(); } - //llinfos << count << " : " << mDiffResult << llendl; } + +void LLSceneMonitor::addMonitorResult() +{ + mRecording->extend(); + sample(sFramePixelDiff, mDiffResult); + + ll_monitor_result_t result; + result.mTimeStamp = LLImageGL::sLastFrameTime; + result.mDiff = mDiffResult; + mMonitorResults.push_back(result); +} + +//dump results to a file _scene_monitor_results.csv +void LLSceneMonitor::dumpToFile(std::string file_name) +{ + if(mMonitorResults.empty()) + { + return; //nothing to dump + } + + std::ofstream os(file_name.c_str()); + + //total scene loading time + os << llformat("Scene Loading time: %.4f seconds\n", (F32)getRecording()->getAcceptedRecording().getDuration().value()); + + S32 num_results = mMonitorResults.size(); + for(S32 i = 0; i < num_results; i++) + { + os << llformat("%.4f %.4f\n", mMonitorResults[i].mTimeStamp, mMonitorResults[i].mDiff); + } + + os.flush(); + os.close(); + + mMonitorResults.clear(); +} + //------------------------------------------------------------------------------------------------------------- //definition of class LLSceneMonitorView //------------------------------------------------------------------------------------------------------------- -- cgit v1.2.3 From 5334c15852b0669be74546d4fa11c58a279dda2d Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 28 Mar 2013 16:31:49 -0600 Subject: change scene loading monitor frame diff filter threshold value. --- indra/newview/llscenemonitor.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 5cde573855..8655aa4521 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -483,15 +483,18 @@ void LLSceneMonitor::fetchQueryResult() glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) - - if(mDiffResult > 0.01f) - { - addMonitorResult(); - } + + addMonitorResult(); } void LLSceneMonitor::addMonitorResult() { + const F32 diff_threshold = 0.001f; + if(mDiffResult < diff_threshold) + { + return; + } + mRecording->extend(); sample(sFramePixelDiff, mDiffResult); -- cgit v1.2.3 From 7a33d88886d9f9d83d3d12c95bb41e0093159d58 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 28 Mar 2013 16:52:36 -0600 Subject: freeze particle system when monitor scene loading --- indra/newview/llscenemonitor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 8655aa4521..afb03ff268 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -39,6 +39,7 @@ #include "llspatialpartition.h" #include "llagent.h" #include "pipeline.h" +#include "llviewerpartsim.h" LLSceneMonitorView* gSceneMonitorView = NULL; @@ -273,8 +274,12 @@ void LLSceneMonitor::freezeScene() // freeze everything else gSavedSettings.setBOOL("FreezeTime", TRUE); + //disable sky, water and clouds gPipeline.clearRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); + + //disable particle system + LLViewerPartSim::getInstance()->enable(false); } void LLSceneMonitor::unfreezeScene() @@ -285,8 +290,12 @@ void LLSceneMonitor::unfreezeScene() // thaw everything else gSavedSettings.setBOOL("FreezeTime", FALSE); + //enable sky, water and clouds gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); + + //enable particle system + LLViewerPartSim::getInstance()->enable(true); } void LLSceneMonitor::capture() -- cgit v1.2.3 From 164273afbb8131c5961266b7cb2c1e1d7973ea0b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 4 Apr 2013 16:47:36 -0600 Subject: fix some warnings caused by scenen loading monitoring when quit viewer. --- indra/newview/llscenemonitor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index afb03ff268..3a2171a014 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -65,6 +65,7 @@ LLSceneMonitor::LLSceneMonitor() : mHasNewDiff(FALSE), mHasNewQueryResult(FALSE), mDebugViewerVisible(FALSE), + mQuitting(FALSE), mQueryObject(0), mSamplingTime(1.0f), mDiffPixelRatio(0.5f) @@ -78,6 +79,7 @@ LLSceneMonitor::LLSceneMonitor() : LLSceneMonitor::~LLSceneMonitor() { + mQuitting = TRUE; destroyClass(); } @@ -287,6 +289,11 @@ void LLSceneMonitor::unfreezeScene() //thaw all avatars mAvatarPauseHandles.clear(); + if(mQuitting) + { + return; //we are quitting viewer. + } + // thaw everything else gSavedSettings.setBOOL("FreezeTime", FALSE); -- cgit v1.2.3 From 7e4c8b94d82680891116bd954289171b8f620bbc Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 10 Apr 2013 20:24:51 -0600 Subject: fix a logout crash --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index c06d9d2689..15fe77f028 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -523,7 +523,7 @@ void LLSceneMonitor::addMonitorResult() //dump results to a file _scene_monitor_results.csv void LLSceneMonitor::dumpToFile(std::string file_name) { - if(mMonitorResults.empty()) + if(mMonitorResults.empty() || !getRecording()) { return; //nothing to dump } -- cgit v1.2.3 From c6737163854981d94fde8bdd440eaf4bbc816b4f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 23 Apr 2013 18:52:34 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics convert scene monitor to use extendable periodic recording --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 15fe77f028..7f7e61cc88 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -73,7 +73,7 @@ LLSceneMonitor::LLSceneMonitor() : mFrames[0] = NULL; mFrames[1] = NULL; - mRecording = new LLTrace::ExtendableRecording(); + mRecording = new LLTrace::ExtendablePeriodicRecording(); mRecording->start(); } -- cgit v1.2.3 From 3a0e45ff088278cba5314974be6539b05009b8da Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 10 May 2013 17:57:12 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics renamed LLView::handleVisibilityChange to onVisibilityChange to reflect standard naming conventions for handlers vs. reactors --- indra/newview/llscenemonitor.cpp | 183 ++++++++++++++++++--------------------- 1 file changed, 85 insertions(+), 98 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 7f7e61cc88..5a5fd6f333 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -56,18 +56,16 @@ LLSceneMonitorView* gSceneMonitorView = NULL; // LLSceneMonitor::LLSceneMonitor() : - mEnabled(FALSE), + mEnabled(false), mDiff(NULL), mDiffResult(0.f), mDiffTolerance(0.1f), - mCurTarget(NULL), - mNeedsUpdateDiff(FALSE), - mHasNewDiff(FALSE), - mHasNewQueryResult(FALSE), - mDebugViewerVisible(FALSE), - mQuitting(FALSE), + mNeedsUpdateDiff(false), + mHasNewDiff(false), + mHasNewQueryResult(false), + mDebugViewerVisible(false), + mQuitting(false), mQueryObject(0), - mSamplingTime(1.0f), mDiffPixelRatio(0.5f) { mFrames[0] = NULL; @@ -79,7 +77,7 @@ LLSceneMonitor::LLSceneMonitor() : LLSceneMonitor::~LLSceneMonitor() { - mQuitting = TRUE; + mQuitting = true; destroyClass(); } @@ -101,7 +99,6 @@ void LLSceneMonitor::reset() mFrames[0] = NULL; mFrames[1] = NULL; mDiff = NULL; - mCurTarget = NULL; unfreezeScene(); @@ -173,54 +170,15 @@ void LLSceneMonitor::generateDitheringTexture(S32 width, S32 height) mDitherScaleT = (F32)height / mDitherMatrixWidth; } -void LLSceneMonitor::setDebugViewerVisible(BOOL visible) +void LLSceneMonitor::setDebugViewerVisible(bool visible) { mDebugViewerVisible = visible; } -bool LLSceneMonitor::preCapture() +LLRenderTarget& LLSceneMonitor::getCaptureTarget() { - static LLCachedControl monitor_enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); - static LLFrameTimer timer; - - mCurTarget = NULL; - if (!LLGLSLShader::sNoFixedFunction) - { - return false; - } - - BOOL enabled = (BOOL)monitor_enabled || mDebugViewerVisible; - if(mEnabled != enabled) - { - if(mEnabled) - { - reset(); - unfreezeScene(); - } - else - { - freezeScene(); - } - - mEnabled = enabled; - } - - if(!mEnabled) - { - return false; - } - - if(gAgent.isPositionChanged()) - { - mRecording->reset(); - } + LLRenderTarget* cur_target = NULL; - if(timer.getElapsedTimeF32() < mSamplingTime) - { - return false; - } - timer.reset(); - S32 width = gViewerWindow->getWorldViewWidthRaw(); S32 height = gViewerWindow->getWorldViewHeightRaw(); @@ -232,7 +190,7 @@ bool LLSceneMonitor::preCapture() gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - mCurTarget = mFrames[0]; + cur_target = mFrames[0]; } else if(!mFrames[1]) { @@ -242,21 +200,22 @@ bool LLSceneMonitor::preCapture() gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - mCurTarget = mFrames[1]; + cur_target = mFrames[1]; } else //swap { - mCurTarget = mFrames[0]; + cur_target = mFrames[0]; mFrames[0] = mFrames[1]; - mFrames[1] = mCurTarget; + mFrames[1] = cur_target; } - if(mCurTarget->getWidth() != width || mCurTarget->getHeight() != height) //size changed + if(cur_target->getWidth() != width || cur_target->getHeight() != height) //size changed { - mCurTarget->resize(width, height, GL_RGB); + cur_target->resize(width, height, GL_RGB); } - return true; + // we're promising the target exists + return *cur_target; } void LLSceneMonitor::freezeAvatar(LLCharacter* avatarp) @@ -308,33 +267,56 @@ void LLSceneMonitor::unfreezeScene() void LLSceneMonitor::capture() { static U32 last_capture_time = 0; + static LLCachedControl monitor_enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); + static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); + static LLFrameTimer timer; - if(last_capture_time == gFrameCount) + LLTrace::Recording* last_frame_recording = LLTrace::get_frame_recording()->getPrevRecording(); + if (last_frame_recording->getMax(LLViewerCamera::getVelocityStat()) > 0.001f + || last_frame_recording->getMax(LLViewerCamera::getAngularVelocityStat() > 0.01f) { - return; + mRecording->reset(); } - last_capture_time = gFrameCount; - preCapture(); - - if(!mCurTarget) + bool enabled = monitor_enabled || mDebugViewerVisible; + if(mEnabled != enabled) { - return; + if(mEnabled) + { + reset(); + unfreezeScene(); + } + else + { + freezeScene(); + } + + mEnabled = enabled; } - - U32 old_FBO = LLRenderTarget::sCurFBO; - gGL.getTexUnit(0)->bind(mCurTarget); - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); //point to the main frame buffer. + if(timer.getElapsedTimeF32() > scene_load_sample_time() + && mEnabled + && LLGLShader::sNoFixedFunction + && last_capture_time != gFrameCount) + { + timer.reset(); + last_capture_time = gFrameCount; + + LLRenderTarget& cur_target = getCaptureTarget(); + + U32 old_FBO = LLRenderTarget::sCurFBO; + + gGL.getTexUnit(0)->bind(&cur_target); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); //point to the main frame buffer. - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, mCurTarget->getWidth(), mCurTarget->getHeight()); //copy the content + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, cur_target.getWidth(), cur_target.getHeight()); //copy the content - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - glBindFramebuffer(GL_FRAMEBUFFER, old_FBO); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, old_FBO); - mCurTarget = NULL; - mNeedsUpdateDiff = TRUE; + mNeedsUpdateDiff = true; + } } bool LLSceneMonitor::needsUpdate() const @@ -342,27 +324,33 @@ bool LLSceneMonitor::needsUpdate() const return mNeedsUpdateDiff; } +static LLFastTimer::DeclareTimer FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE("Generate Scene Load Dither Texture"); +static LLFastTimer::DeclareTimer FTM_SCENE_LOAD_IMAGE_DIFF("Scene Load Image Diff"); + void LLSceneMonitor::compare() { if(!mNeedsUpdateDiff) { return; } - mNeedsUpdateDiff = FALSE; + mNeedsUpdateDiff = false; if(!mFrames[0] || !mFrames[1]) { return; } if(mFrames[0]->getWidth() != mFrames[1]->getWidth() || mFrames[0]->getHeight() != mFrames[1]->getHeight()) - { - return; //size does not match + { //size does not match + return; } + LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + S32 width = gViewerWindow->getWindowWidthRaw(); S32 height = gViewerWindow->getWindowHeightRaw(); if(!mDiff) { + LLFastTimer _(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); mDiff = new LLRenderTarget(); mDiff->allocate(width, height, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true); @@ -370,6 +358,7 @@ void LLSceneMonitor::compare() } else if(mDiff->getWidth() != width || mDiff->getHeight() != height) { + LLFastTimer _(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); mDiff->resize(width, height, GL_RGBA); generateDitheringTexture(width, height); } @@ -411,9 +400,8 @@ void LLSceneMonitor::compare() gGL.getTexUnit(2)->disable(); gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); - mHasNewDiff = TRUE; + mHasNewDiff = true; - //send out the query request. queryDiff(); } @@ -430,6 +418,8 @@ void LLSceneMonitor::queryDiff() //calculate Diff aggregate information in GPU, and enable gl occlusion query to capture it. void LLSceneMonitor::calcDiffAggregate() { + LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + if(!mHasNewDiff && !mDebugViewerVisible) { return; @@ -462,8 +452,8 @@ void LLSceneMonitor::calcDiffAggregate() if(mHasNewDiff) { glEndQueryARB(GL_SAMPLES_PASSED_ARB); - mHasNewDiff = FALSE; - mHasNewQueryResult = TRUE; + mHasNewDiff = false; + mHasNewQueryResult = true; } gOneTextureFilterProgram.unbind(); @@ -482,11 +472,13 @@ void LLSceneMonitor::calcDiffAggregate() static LLTrace::MeasurementStatHandle<> sFramePixelDiff("FramePixelDifference"); void LLSceneMonitor::fetchQueryResult() { + LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + if(!mHasNewQueryResult) { return; } - mHasNewQueryResult = FALSE; + mHasNewQueryResult = false; GLuint available = 0; glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available); @@ -500,25 +492,22 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) - addMonitorResult(); -} + sample(sFramePixelDiff, mDiffResult); -void LLSceneMonitor::addMonitorResult() -{ const F32 diff_threshold = 0.001f; - if(mDiffResult < diff_threshold) + if(mDiffResult > diff_threshold) { - return; - } - mRecording->extend(); - sample(sFramePixelDiff, mDiffResult); + } +} +void LLSceneMonitor::addMonitorResult() +{ ll_monitor_result_t result; result.mTimeStamp = LLImageGL::sLastFrameTime; result.mDiff = mDiffResult; mMonitorResults.push_back(result); - } +} //dump results to a file _scene_monitor_results.csv void LLSceneMonitor::dumpToFile(std::string file_name) @@ -563,12 +552,10 @@ void LLSceneMonitorView::onClickCloseBtn() setVisible(false); } -void LLSceneMonitorView::setVisible(BOOL visible) +void LLSceneMonitorView::onVisibilityChange(BOOL visible) { visible = visible && LLGLSLShader::sNoFixedFunction; LLSceneMonitor::getInstance()->setDebugViewerVisible(visible); - - LLView::setVisible(visible); } void LLSceneMonitorView::draw() @@ -608,7 +595,7 @@ void LLSceneMonitorView::draw() LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); lines++; - num_str = llformat("Sampling time: %.3f seconds", LLSceneMonitor::getInstance()->getSamplingTime()); + num_str = llformat("Sampling time: %.3f seconds", gSavedSettings->getF32("SceneLoadingMonitorSampleTime")); LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); lines++; -- cgit v1.2.3 From edf731c180a61dc49255ebb25342b6256e8d6065 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 10 May 2013 22:24:18 -0700 Subject: BUILDFIX - bad logic in scene monitor frame recording --- indra/newview/llscenemonitor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 5a5fd6f333..2e819c8efe 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -271,9 +271,9 @@ void LLSceneMonitor::capture() static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); static LLFrameTimer timer; - LLTrace::Recording* last_frame_recording = LLTrace::get_frame_recording()->getPrevRecording(); - if (last_frame_recording->getMax(LLViewerCamera::getVelocityStat()) > 0.001f - || last_frame_recording->getMax(LLViewerCamera::getAngularVelocityStat() > 0.01f) + LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording(); + if (last_frame_recording.getSum(*LLViewerCamera::getVelocityStat()) > 0.001f + || last_frame_recording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.01f) { mRecording->reset(); } @@ -296,7 +296,7 @@ void LLSceneMonitor::capture() if(timer.getElapsedTimeF32() > scene_load_sample_time() && mEnabled - && LLGLShader::sNoFixedFunction + && LLGLSLShader::sNoFixedFunction && last_capture_time != gFrameCount) { timer.reset(); @@ -595,7 +595,7 @@ void LLSceneMonitorView::draw() LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); lines++; - num_str = llformat("Sampling time: %.3f seconds", gSavedSettings->getF32("SceneLoadingMonitorSampleTime")); + num_str = llformat("Sampling time: %.3f seconds", gSavedSettings.getF32("SceneLoadingMonitorSampleTime")); LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); lines++; -- cgit v1.2.3 From 405aa5b1ba7b786da05136fc9cc1f0a664111ce8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 13 May 2013 11:04:10 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics added log output for scene monitoring --- indra/newview/llscenemonitor.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 2e819c8efe..9546c786d1 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -50,7 +50,7 @@ LLSceneMonitorView* gSceneMonitorView = NULL; //2, (?) disable all sky and water; //3, capture frames periodically, by calling "capture()"; //4, compute pixel differences between two latest captured frames, by calling "compare()", results are stored at mDiff; -//5, compute the number of pixels in mDiff above some tolerance threshold in GPU, by calling "queryDiff() -> calcDiffAggregate()"; +//5, compute the number of pixels in mDiff above some tolerance threshold in GPU, by calling "calcDiffAggregate()"; //6, use gl occlusion query to fetch the result from GPU, by calling "fetchQueryResult()"; //END. // @@ -402,17 +402,10 @@ void LLSceneMonitor::compare() mHasNewDiff = true; - queryDiff(); -} - -void LLSceneMonitor::queryDiff() -{ - if(mDebugViewerVisible) + if (!mDebugViewerVisible) { - return; + calcDiffAggregate(); } - - calcDiffAggregate(); } //calculate Diff aggregate information in GPU, and enable gl occlusion query to capture it. @@ -492,6 +485,7 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) + LL_DEBUGS("SceneMonitor") << "Frame difference: " << mDiffResult << LL_ENDL; sample(sFramePixelDiff, mDiffResult); const F32 diff_threshold = 0.001f; -- cgit v1.2.3 From 35f1fcc399f07571fc6b7d7af00e7d4e1e07418d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 13 May 2013 11:44:42 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics improved precision of scene diff log output --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 9546c786d1..3d8e1513dd 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -485,7 +485,7 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) - LL_DEBUGS("SceneMonitor") << "Frame difference: " << mDiffResult << LL_ENDL; + LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; sample(sFramePixelDiff, mDiffResult); const F32 diff_threshold = 0.001f; -- cgit v1.2.3 From 12c34dc30f0cb6270c11e100fcaceb3fa6b27e81 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 16 May 2013 00:53:01 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics renamed LLView::handleVisibilityChange to onVisibilityChange to reflect cleaned up scene monitor stats recording, now all trace stats dumped to csv also fixed extendablerecording, periodicrecording, etc. to properly implement start/stop/etc --- indra/newview/llscenemonitor.cpp | 196 ++++++++++++++++++++++++++++----------- 1 file changed, 143 insertions(+), 53 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 3d8e1513dd..c101fe7deb 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -60,11 +60,8 @@ LLSceneMonitor::LLSceneMonitor() : mDiff(NULL), mDiffResult(0.f), mDiffTolerance(0.1f), - mNeedsUpdateDiff(false), - mHasNewDiff(false), - mHasNewQueryResult(false), + mDiffState(WAITING_FOR_NEXT_DIFF), mDebugViewerVisible(false), - mQuitting(false), mQueryObject(0), mDiffPixelRatio(0.5f) { @@ -72,12 +69,11 @@ LLSceneMonitor::LLSceneMonitor() : mFrames[1] = NULL; mRecording = new LLTrace::ExtendablePeriodicRecording(); - mRecording->start(); } LLSceneMonitor::~LLSceneMonitor() { - mQuitting = true; + mDiffState = VIEWER_QUITTING; destroyClass(); } @@ -100,6 +96,8 @@ void LLSceneMonitor::reset() mFrames[1] = NULL; mDiff = NULL; + mRecording->reset(); + unfreezeScene(); if(mQueryObject > 0) @@ -248,7 +246,7 @@ void LLSceneMonitor::unfreezeScene() //thaw all avatars mAvatarPauseHandles.clear(); - if(mQuitting) + if(mDiffState == VIEWER_QUITTING) { return; //we are quitting viewer. } @@ -267,7 +265,7 @@ void LLSceneMonitor::unfreezeScene() void LLSceneMonitor::capture() { static U32 last_capture_time = 0; - static LLCachedControl monitor_enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); + static LLCachedControl monitor_enabled(gSavedSettings, "SceneLoadingMonitorEnabled"); static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); static LLFrameTimer timer; @@ -275,7 +273,7 @@ void LLSceneMonitor::capture() if (last_frame_recording.getSum(*LLViewerCamera::getVelocityStat()) > 0.001f || last_frame_recording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.01f) { - mRecording->reset(); + reset(); } bool enabled = monitor_enabled || mDebugViewerVisible; @@ -283,11 +281,11 @@ void LLSceneMonitor::capture() { if(mEnabled) { - reset(); unfreezeScene(); } else { + reset(); freezeScene(); } @@ -299,7 +297,10 @@ void LLSceneMonitor::capture() && LLGLSLShader::sNoFixedFunction && last_capture_time != gFrameCount) { + mRecording->resume(); + timer.reset(); + last_capture_time = gFrameCount; LLRenderTarget& cur_target = getCaptureTarget(); @@ -315,13 +316,13 @@ void LLSceneMonitor::capture() glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, old_FBO); - mNeedsUpdateDiff = true; + mDiffState = NEED_DIFF; } } bool LLSceneMonitor::needsUpdate() const { - return mNeedsUpdateDiff; + return mDiffState == NEED_DIFF; } static LLFastTimer::DeclareTimer FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE("Generate Scene Load Dither Texture"); @@ -329,11 +330,10 @@ static LLFastTimer::DeclareTimer FTM_SCENE_LOAD_IMAGE_DIFF("Scene Load Image Dif void LLSceneMonitor::compare() { - if(!mNeedsUpdateDiff) + if(mDiffState != NEED_DIFF) { return; } - mNeedsUpdateDiff = false; if(!mFrames[0] || !mFrames[1]) { @@ -345,6 +345,7 @@ void LLSceneMonitor::compare() } LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + mDiffState = EXECUTE_DIFF; S32 width = gViewerWindow->getWindowWidthRaw(); S32 height = gViewerWindow->getWindowHeightRaw(); @@ -400,8 +401,6 @@ void LLSceneMonitor::compare() gGL.getTexUnit(2)->disable(); gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); - mHasNewDiff = true; - if (!mDebugViewerVisible) { calcDiffAggregate(); @@ -413,7 +412,7 @@ void LLSceneMonitor::calcDiffAggregate() { LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); - if(!mHasNewDiff && !mDebugViewerVisible) + if(mDiffState != EXECUTE_DIFF && !mDebugViewerVisible) { return; } @@ -435,18 +434,17 @@ void LLSceneMonitor::calcDiffAggregate() gOneTextureFilterProgram.bind(); gOneTextureFilterProgram.uniform1f("tolerance", mDiffTolerance); - if(mHasNewDiff) + if(mDiffState == EXECUTE_DIFF) { glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mQueryObject); } gl_draw_scaled_target(0, 0, S32(mDiff->getWidth() * mDiffPixelRatio), S32(mDiff->getHeight() * mDiffPixelRatio), mDiff); - if(mHasNewDiff) + if(mDiffState == EXECUTE_DIFF) { glEndQueryARB(GL_SAMPLES_PASSED_ARB); - mHasNewDiff = false; - mHasNewQueryResult = true; + mDiffState = WAIT_ON_RESULT; } gOneTextureFilterProgram.unbind(); @@ -467,31 +465,30 @@ void LLSceneMonitor::fetchQueryResult() { LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); - if(!mHasNewQueryResult) - { - return; - } - mHasNewQueryResult = false; - - GLuint available = 0; - glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available); - if(!available) + if(mDiffState == WAIT_ON_RESULT) { - return; - } + mDiffState = WAITING_FOR_NEXT_DIFF; - GLuint count = 0; - glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); + GLuint available = 0; + glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available); + if(available) + { + GLuint count = 0; + glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); - mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) + mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) - LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; - sample(sFramePixelDiff, mDiffResult); + LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; + sample(sFramePixelDiff, mDiffResult); - const F32 diff_threshold = 0.001f; - if(mDiffResult > diff_threshold) - { - mRecording->extend(); + mRecording->getPotentialRecording().nextPeriod(); + + static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); + if(mDiffResult > diff_threshold()) + { + mRecording->extend(); + } + } } } @@ -503,29 +500,124 @@ void LLSceneMonitor::addMonitorResult() mMonitorResults.push_back(result); } -//dump results to a file _scene_monitor_results.csv +//dump results to a file _scene_xmonitor_results.csv void LLSceneMonitor::dumpToFile(std::string file_name) { - if(mMonitorResults.empty() || !getRecording()) - { - return; //nothing to dump - } + LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL; std::ofstream os(file_name.c_str()); //total scene loading time - os << llformat("Scene Loading time: %.4f seconds\n", (F32)getRecording()->getAcceptedRecording().getDuration().value()); + os << std::setprecision(4); + + LLTrace::PeriodicRecording& scene_load_recording = mRecording->getAcceptedRecording(); + U32 frame_count = scene_load_recording.getNumPeriods(); + + LLUnit frame_time; + + os << "Stat"; + for (S32 frame = 0; frame < frame_count; frame++) + { + frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); + os << ", " << frame_time.value(); + } + os << std::endl; + + for (LLTrace::CountStatHandle::instance_iter it = LLTrace::CountStatHandle::beginInstances(), end_it = LLTrace::CountStatHandle::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; + + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getSum(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } + } + + for (LLTrace::CountStatHandle::instance_iter it = LLTrace::CountStatHandle::beginInstances(), end_it = LLTrace::CountStatHandle::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; + + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getSum(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } + } + + for (LLTrace::MeasurementStatHandle::instance_iter it = LLTrace::MeasurementStatHandle::beginInstances(), end_it = LLTrace::MeasurementStatHandle::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; - S32 num_results = mMonitorResults.size(); - for(S32 i = 0; i < num_results; i++) + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } + } + + for (LLTrace::MeasurementStatHandle::instance_iter it = LLTrace::MeasurementStatHandle::beginInstances(), end_it = LLTrace::MeasurementStatHandle::endInstances(); + it != end_it; + ++it) { - os << llformat("%.4f %.4f\n", mMonitorResults[i].mTimeStamp, mMonitorResults[i].mDiff); + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; + + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } } os.flush(); os.close(); - mMonitorResults.clear(); } //------------------------------------------------------------------------------------------------------------- @@ -563,8 +655,6 @@ void LLSceneMonitorView::draw() F32 ratio = LLSceneMonitor::getInstance()->getDiffPixelRatio(); S32 height = (S32)(target->getHeight() * ratio); S32 width = (S32)(target->getWidth() * ratio); - //S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.5f); - //S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.5f); LLRect new_rect; new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); -- cgit v1.2.3 From f850ae03b399a5cc7aa32f82b8ed996518a86a2a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 20 May 2013 00:01:57 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics fixed copy construction of Recorders, eliminated most zero-length frames fixed reset behavior of periodic recordings and extendable recordings to clear entire history removed busy-loop recording of stats from worker threads...stats reported only when work is done --- indra/newview/llscenemonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index c101fe7deb..c2e00384a1 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -481,13 +481,13 @@ void LLSceneMonitor::fetchQueryResult() LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; sample(sFramePixelDiff, mDiffResult); - mRecording->getPotentialRecording().nextPeriod(); - static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); if(mDiffResult > diff_threshold()) { mRecording->extend(); } + + mRecording->getPotentialRecording().nextPeriod(); } } } -- cgit v1.2.3 From 1225a7a3cc29e3b6429fa0af87204599e98bee3e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 20 May 2013 00:49:57 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics further improvements that should eliminate more short duration recording periods --- indra/newview/llscenemonitor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index c2e00384a1..b7517a057e 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -486,8 +486,10 @@ void LLSceneMonitor::fetchQueryResult() { mRecording->extend(); } - - mRecording->getPotentialRecording().nextPeriod(); + else + { + mRecording->getPotentialRecording().nextPeriod(); + } } } } -- cgit v1.2.3 From ab5106535758393e02b075d1e404e4e1fcf81abf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 20 May 2013 19:27:50 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics removed extra dereference for copy on write pointer moved copyonwrite mechanism to RecordingBuffers from individual buffer fixed logic that was leaving scene unfrozen when camera moved during metrics gathering --- indra/newview/llscenemonitor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index b7517a057e..b303dfbdb4 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -270,10 +270,12 @@ void LLSceneMonitor::capture() static LLFrameTimer timer; LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording(); - if (last_frame_recording.getSum(*LLViewerCamera::getVelocityStat()) > 0.001f - || last_frame_recording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.01f) + if (mEnabled + && (last_frame_recording.getSum(*LLViewerCamera::getVelocityStat()) > 0.001f + || last_frame_recording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.01f)) { reset(); + freezeScene(); } bool enabled = monitor_enabled || mDebugViewerVisible; -- cgit v1.2.3 From e8daeb177deccff29182ee97c143b0350e8c727c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 22 May 2013 21:19:46 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics clean up of llscenemonitor.cpp --- indra/newview/llscenemonitor.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index b303dfbdb4..94c2e40bb1 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -496,14 +496,6 @@ void LLSceneMonitor::fetchQueryResult() } } -void LLSceneMonitor::addMonitorResult() -{ - ll_monitor_result_t result; - result.mTimeStamp = LLImageGL::sLastFrameTime; - result.mDiff = mDiffResult; - mMonitorResults.push_back(result); -} - //dump results to a file _scene_xmonitor_results.csv void LLSceneMonitor::dumpToFile(std::string file_name) { -- cgit v1.2.3 From 16616ae48d86da75b3809fa6be6c846a9d420603 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 23 May 2013 18:25:21 -0600 Subject: for SH-4145: Interesting: Implement occlusion culling for object cache --- indra/newview/llscenemonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 15fe77f028..c592fd0a38 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -107,7 +107,7 @@ void LLSceneMonitor::reset() if(mQueryObject > 0) { - release_occlusion_query_object_name(mQueryObject); + LLOcclusionCullingGroup::releaseOcclusionQueryObjectName(mQueryObject); mQueryObject = 0; } } @@ -437,7 +437,7 @@ void LLSceneMonitor::calcDiffAggregate() if(!mQueryObject) { - mQueryObject = get_new_occlusion_query_object_name(); + mQueryObject = LLOcclusionCullingGroup::getNewOcclusionQueryObjectName(); } LLGLDepthTest depth(true, false, GL_ALWAYS); -- cgit v1.2.3 From 9ae76d12157641033431381959ef4f798a119b8d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 29 May 2013 17:00:50 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics fixed copy construction behavior of Recordings to not zero out data split measurement into event and sample, with sample representing a continuous function --- indra/newview/llscenemonitor.cpp | 57 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 94c2e40bb1..15f2f6d762 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -462,7 +462,7 @@ void LLSceneMonitor::calcDiffAggregate() } } -static LLTrace::MeasurementStatHandle<> sFramePixelDiff("FramePixelDifference"); +static LLTrace::EventStatHandle<> sFramePixelDiff("FramePixelDifference"); void LLSceneMonitor::fetchQueryResult() { LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); @@ -481,16 +481,18 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; - sample(sFramePixelDiff, mDiffResult); + record(sFramePixelDiff, mDiffResult); static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); if(mDiffResult > diff_threshold()) { mRecording->extend(); + llassert(mRecording->getAcceptedRecording().getLastRecording().getSum(LLStatViewer::FPS)); } else { mRecording->getPotentialRecording().nextPeriod(); + llassert(mRecording->getPotentialRecording().getLastRecording().getSum(LLStatViewer::FPS)); } } } @@ -503,7 +505,6 @@ void LLSceneMonitor::dumpToFile(std::string file_name) std::ofstream os(file_name.c_str()); - //total scene loading time os << std::setprecision(4); LLTrace::PeriodicRecording& scene_load_recording = mRecording->getAcceptedRecording(); @@ -565,7 +566,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (LLTrace::MeasurementStatHandle::instance_iter it = LLTrace::MeasurementStatHandle::beginInstances(), end_it = LLTrace::MeasurementStatHandle::endInstances(); + for (LLTrace::EventStatHandle::instance_iter it = LLTrace::EventStatHandle::beginInstances(), end_it = LLTrace::EventStatHandle::endInstances(); it != end_it; ++it) { @@ -588,7 +589,53 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (LLTrace::MeasurementStatHandle::instance_iter it = LLTrace::MeasurementStatHandle::beginInstances(), end_it = LLTrace::MeasurementStatHandle::endInstances(); + for (LLTrace::EventStatHandle::instance_iter it = LLTrace::EventStatHandle::beginInstances(), end_it = LLTrace::EventStatHandle::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; + + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } + } + + for (LLTrace::SampleStatHandle::instance_iter it = LLTrace::SampleStatHandle::beginInstances(), end_it = LLTrace::SampleStatHandle::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; + + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } + } + + for (LLTrace::SampleStatHandle::instance_iter it = LLTrace::SampleStatHandle::beginInstances(), end_it = LLTrace::SampleStatHandle::endInstances(); it != end_it; ++it) { -- cgit v1.2.3 From 9def3590f41dee3cba7760e4443fdc71f5fb2db6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 31 May 2013 16:01:46 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics fixed multithreading lltrace causing values to be interpolated towards 0 added Radians unit improved sceneloadmonitor restart heuristic to use accumulated camera motion --- indra/newview/llscenemonitor.cpp | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index a28c2eac20..7eb48eb575 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -67,22 +67,13 @@ LLSceneMonitor::LLSceneMonitor() : { mFrames[0] = NULL; mFrames[1] = NULL; - - mRecording = new LLTrace::ExtendablePeriodicRecording(); } LLSceneMonitor::~LLSceneMonitor() { mDiffState = VIEWER_QUITTING; - destroyClass(); -} - -void LLSceneMonitor::destroyClass() -{ reset(); - delete mRecording; - mRecording = NULL; mDitheringTexture = NULL; } @@ -96,7 +87,8 @@ void LLSceneMonitor::reset() mFrames[1] = NULL; mDiff = NULL; - mRecording->reset(); + mMonitorRecording.reset(); + mSceneLoadRecording.reset(); unfreezeScene(); @@ -269,10 +261,9 @@ void LLSceneMonitor::capture() static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); static LLFrameTimer timer; - LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording(); if (mEnabled - && (last_frame_recording.getSum(*LLViewerCamera::getVelocityStat()) > 0.001f - || last_frame_recording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.01f)) + && (mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f + || mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f)) { reset(); freezeScene(); @@ -299,7 +290,8 @@ void LLSceneMonitor::capture() && LLGLSLShader::sNoFixedFunction && last_capture_time != gFrameCount) { - mRecording->resume(); + mSceneLoadRecording.resume(); + mMonitorRecording.resume(); timer.reset(); @@ -486,13 +478,13 @@ void LLSceneMonitor::fetchQueryResult() static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); if(mDiffResult > diff_threshold()) { - mRecording->extend(); - llassert(mRecording->getAcceptedRecording().getLastRecording().getSum(LLStatViewer::FPS)); + mSceneLoadRecording.extend(); + llassert(mSceneLoadRecording.getAcceptedRecording().getLastRecording().getSum(LLStatViewer::FPS)); } else { - mRecording->getPotentialRecording().nextPeriod(); - llassert(mRecording->getPotentialRecording().getLastRecording().getSum(LLStatViewer::FPS)); + mSceneLoadRecording.getPotentialRecording().nextPeriod(); + llassert(mSceneLoadRecording.getPotentialRecording().getLastRecording().getSum(LLStatViewer::FPS)); } } } @@ -501,13 +493,15 @@ void LLSceneMonitor::fetchQueryResult() //dump results to a file _scene_xmonitor_results.csv void LLSceneMonitor::dumpToFile(std::string file_name) { + if (!hasResults()) return; + LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL; std::ofstream os(file_name.c_str()); os << std::setprecision(4); - LLTrace::PeriodicRecording& scene_load_recording = mRecording->getAcceptedRecording(); + LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording(); U32 frame_count = scene_load_recording.getNumPeriods(); LLUnit frame_time; -- cgit v1.2.3 From fd21ddd9d0adf7342fe89d371868c3f7f7ca9f5f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 31 May 2013 23:40:10 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics made recordings auto-update when executing query while active --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 7eb48eb575..bb1cfaa9a8 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -240,7 +240,7 @@ void LLSceneMonitor::unfreezeScene() if(mDiffState == VIEWER_QUITTING) { - return; //we are quitting viewer. + return; } // thaw everything else -- cgit v1.2.3 From 233201f8227f92e93061d3e2393a17b42dfa3dd1 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 2 Jun 2013 22:49:17 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics removed unnecessary templates from accumulator types...now always track data in double precision floating point, using templated accessors to convert to and from arbitrary types --- indra/newview/llscenemonitor.cpp | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index bb1cfaa9a8..1bbd6ae2b9 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -493,6 +493,7 @@ void LLSceneMonitor::fetchQueryResult() //dump results to a file _scene_xmonitor_results.csv void LLSceneMonitor::dumpToFile(std::string file_name) { + using namespace LLTrace; if (!hasResults()) return; LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL; @@ -501,7 +502,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) os << std::setprecision(4); - LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording(); + PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording(); U32 frame_count = scene_load_recording.getNumPeriods(); LLUnit frame_time; @@ -514,7 +515,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } os << std::endl; - for (LLTrace::CountStatHandle::instance_iter it = LLTrace::CountStatHandle::beginInstances(), end_it = LLTrace::CountStatHandle::endInstances(); + for (CountStatHandle::instance_iter it = CountStatHandle::beginInstances(), end_it = CountStatHandle::endInstances(); it != end_it; ++it) { @@ -537,7 +538,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (LLTrace::CountStatHandle::instance_iter it = LLTrace::CountStatHandle::beginInstances(), end_it = LLTrace::CountStatHandle::endInstances(); + for (CountStatHandle::instance_iter it = CountStatHandle::beginInstances(), end_it = CountStatHandle::endInstances(); it != end_it; ++it) { @@ -560,7 +561,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (LLTrace::EventStatHandle::instance_iter it = LLTrace::EventStatHandle::beginInstances(), end_it = LLTrace::EventStatHandle::endInstances(); + for (EventStatHandle::instance_iter it = EventStatHandle::beginInstances(), end_it = EventStatHandle::endInstances(); it != end_it; ++it) { @@ -583,7 +584,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (LLTrace::EventStatHandle::instance_iter it = LLTrace::EventStatHandle::beginInstances(), end_it = LLTrace::EventStatHandle::endInstances(); + for (EventStatHandle::instance_iter it = EventStatHandle::beginInstances(), end_it = EventStatHandle::endInstances(); it != end_it; ++it) { @@ -606,30 +607,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (LLTrace::SampleStatHandle::instance_iter it = LLTrace::SampleStatHandle::beginInstances(), end_it = LLTrace::SampleStatHandle::endInstances(); - it != end_it; - ++it) - { - std::ostringstream row; - row << it->getName(); - - S32 samples = 0; - - for (S32 i = frame_count - 1; i >= 0; --i) - { - samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); - row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); - } - - row << std::endl; - - if (samples > 0) - { - os << row.str(); - } - } - - for (LLTrace::SampleStatHandle::instance_iter it = LLTrace::SampleStatHandle::beginInstances(), end_it = LLTrace::SampleStatHandle::endInstances(); + for (TraceType::instance_iter it = TraceType::beginInstances(), end_it = TraceType::endInstances(); it != end_it; ++it) { -- cgit v1.2.3 From 5b48107dbf969529267874bff9a0a4b892b348cf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 4 Jun 2013 08:33:11 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics added labels to LLUnit types added memstat dumps to llscenemonitor --- indra/newview/llscenemonitor.cpp | 58 +++++++++++----------------------------- 1 file changed, 16 insertions(+), 42 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 1bbd6ae2b9..1a5b43c703 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -492,18 +492,18 @@ void LLSceneMonitor::fetchQueryResult() //dump results to a file _scene_xmonitor_results.csv void LLSceneMonitor::dumpToFile(std::string file_name) -{ - using namespace LLTrace; +{ using namespace LLTrace; + if (!hasResults()) return; LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL; std::ofstream os(file_name.c_str()); - os << std::setprecision(4); + os << std::setprecision(3); PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording(); - U32 frame_count = scene_load_recording.getNumPeriods(); + const U32 frame_count = scene_load_recording.getNumPeriods(); LLUnit frame_time; @@ -515,7 +515,8 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } os << std::endl; - for (CountStatHandle::instance_iter it = CountStatHandle::beginInstances(), end_it = CountStatHandle::endInstances(); + typedef TraceType trace_count; + for (trace_count::instance_iter it = trace_count::beginInstances(), end_it = trace_count::endInstances(); it != end_it; ++it) { @@ -538,30 +539,9 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (CountStatHandle::instance_iter it = CountStatHandle::beginInstances(), end_it = CountStatHandle::endInstances(); - it != end_it; - ++it) - { - std::ostringstream row; - row << it->getName(); - - S32 samples = 0; - - for (S32 i = frame_count - 1; i >= 0; --i) - { - samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); - row << ", " << scene_load_recording.getPrevRecording(i).getSum(*it); - } - - row << std::endl; - - if (samples > 0) - { - os << row.str(); - } - } + typedef TraceType trace_event; - for (EventStatHandle::instance_iter it = EventStatHandle::beginInstances(), end_it = EventStatHandle::endInstances(); + for (trace_event::instance_iter it = trace_event::beginInstances(), end_it = trace_event::endInstances(); it != end_it; ++it) { @@ -584,7 +564,9 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (EventStatHandle::instance_iter it = EventStatHandle::beginInstances(), end_it = EventStatHandle::endInstances(); + typedef TraceType trace_sample; + + for (trace_sample::instance_iter it = trace_sample::beginInstances(), end_it = trace_sample::endInstances(); it != end_it; ++it) { @@ -607,27 +589,19 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - for (TraceType::instance_iter it = TraceType::beginInstances(), end_it = TraceType::endInstances(); + typedef TraceType trace_mem; + for (trace_mem::instance_iter it = trace_mem::beginInstances(), end_it = trace_mem::endInstances(); it != end_it; ++it) { - std::ostringstream row; - row << it->getName(); - - S32 samples = 0; + os << it->getName(); for (S32 i = frame_count - 1; i >= 0; --i) { - samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); - row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + os << ", " << scene_load_recording.getPrevRecording(i).getSum(*it).as().value(); } - row << std::endl; - - if (samples > 0) - { - os << row.str(); - } + os << std::endl; } os.flush(); -- cgit v1.2.3 From 715385eed7b2276963015861d7e6b8196e6ae5cd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 4 Jun 2013 10:54:12 -0700 Subject: BUILDFIX: don't multiple define class statics...use inline static method instead --- indra/newview/llscenemonitor.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 1a5b43c703..f7abb982e1 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -523,12 +523,18 @@ void LLSceneMonitor::dumpToFile(std::string file_name) std::ostringstream row; row << it->getName(); + const char* unit_label = it->getUnitLabel(); + if(unit_label[0]) + { + row << "(" << unit_label << ")"; + } + S32 samples = 0; - for (S32 i = frame_count - 1; i >= 0; --i) + for (S32 frame = 0; frame < frame_count; frame++) { - samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); - row << ", " << scene_load_recording.getPrevRecording(i).getSum(*it); + samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getSum(*it); } row << std::endl; @@ -550,10 +556,10 @@ void LLSceneMonitor::dumpToFile(std::string file_name) S32 samples = 0; - for (S32 i = frame_count - 1; i >= 0; --i) + for (S32 frame = 0; frame < frame_count; frame++) { - samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); - row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it); } row << std::endl; @@ -575,10 +581,10 @@ void LLSceneMonitor::dumpToFile(std::string file_name) S32 samples = 0; - for (S32 i = frame_count - 1; i >= 0; --i) + for (S32 frame = 0; frame < frame_count; frame++) { - samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); - row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it); } row << std::endl; @@ -596,9 +602,9 @@ void LLSceneMonitor::dumpToFile(std::string file_name) { os << it->getName(); - for (S32 i = frame_count - 1; i >= 0; --i) + for (S32 frame = 0; frame < frame_count; frame++) { - os << ", " << scene_load_recording.getPrevRecording(i).getSum(*it).as().value(); + os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getSum(*it).value(); } os << std::endl; @@ -606,7 +612,6 @@ void LLSceneMonitor::dumpToFile(std::string file_name) os.flush(); os.close(); - } //------------------------------------------------------------------------------------------------------------- -- cgit v1.2.3 From a74b5dfa923f8eeccc9b786143f0f832de3ad450 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 4 Jun 2013 19:45:33 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics fixed mem stat tracking...now properly tracks memory footprint with floating point precision cleaned up macros for unit declaration renamed units to SI standard for 1024 multiples (kibibytes, etc) fixed units output for scene monitor dump --- indra/newview/llscenemonitor.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index f7abb982e1..dccf8a2a17 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -554,6 +554,12 @@ void LLSceneMonitor::dumpToFile(std::string file_name) std::ostringstream row; row << it->getName(); + const char* unit_label = it->getUnitLabel(); + if(unit_label[0]) + { + row << "(" << unit_label << ")"; + } + S32 samples = 0; for (S32 frame = 0; frame < frame_count; frame++) @@ -579,6 +585,12 @@ void LLSceneMonitor::dumpToFile(std::string file_name) std::ostringstream row; row << it->getName(); + const char* unit_label = it->getUnitLabel(); + if(unit_label[0]) + { + row << "(" << unit_label << ")"; + } + S32 samples = 0; for (S32 frame = 0; frame < frame_count; frame++) @@ -600,11 +612,11 @@ void LLSceneMonitor::dumpToFile(std::string file_name) it != end_it; ++it) { - os << it->getName(); + os << it->getName() << "(KiB)"; for (S32 frame = 0; frame < frame_count; frame++) { - os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getSum(*it).value(); + os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).as().value(); } os << std::endl; -- cgit v1.2.3 From 9fd3af3c389ed491b515cbb5136b344b069913e4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 13 Jun 2013 15:29:15 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics changed Units macros and argument order to make it more clear optimized units for integer types fixed merging of periodicrecordings...should eliminate duplicate entries in sceneloadmonitor history --- indra/newview/llscenemonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index dccf8a2a17..3d9e0ab4c3 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -503,9 +503,9 @@ void LLSceneMonitor::dumpToFile(std::string file_name) os << std::setprecision(3); PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording(); - const U32 frame_count = scene_load_recording.getNumPeriods(); + const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); - LLUnit frame_time; + LLUnit frame_time; os << "Stat"; for (S32 frame = 0; frame < frame_count; frame++) -- cgit v1.2.3 From 3f2de87340b1c831ea59e4a3ca960d49f343c9fd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 17 Jun 2013 01:18:21 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics added getAs and setAs to LLUnit to make it clearer how you specify units removed accidental 0-based indexing of periodicRecording history... should now be consistently 1-based, with 0 accessing current active recording removed per frame timer updates of all historical timer bars in fast timer display added missing assignment operator to recordings --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 3d9e0ab4c3..8086745471 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -616,7 +616,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) for (S32 frame = 0; frame < frame_count; frame++) { - os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).as().value(); + os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).getAs(); } os << std::endl; -- cgit v1.2.3 From 3fe19d883d2856cd7d104810b794eee82d642a3e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 19 Jun 2013 20:30:41 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics scene monitor output is cleaned up, no duplicate first frame, less scientific notation periodic recording extension now works more cleanly --- indra/newview/llscenemonitor.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 8086745471..ed9eeb9330 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -500,7 +500,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) std::ofstream os(file_name.c_str()); - os << std::setprecision(3); + os << std::setprecision(10); PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording(); const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); @@ -508,12 +508,12 @@ void LLSceneMonitor::dumpToFile(std::string file_name) LLUnit frame_time; os << "Stat"; - for (S32 frame = 0; frame < frame_count; frame++) + for (S32 frame = 1; frame <= frame_count; frame++) { frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); os << ", " << frame_time.value(); } - os << std::endl; + os << '\n'; typedef TraceType trace_count; for (trace_count::instance_iter it = trace_count::beginInstances(), end_it = trace_count::endInstances(); @@ -521,6 +521,8 @@ void LLSceneMonitor::dumpToFile(std::string file_name) ++it) { std::ostringstream row; + row << std::setprecision(10); + row << it->getName(); const char* unit_label = it->getUnitLabel(); @@ -531,13 +533,13 @@ void LLSceneMonitor::dumpToFile(std::string file_name) S32 samples = 0; - for (S32 frame = 0; frame < frame_count; frame++) + for (S32 frame = 1; frame <= frame_count; frame++) { samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it); row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getSum(*it); } - row << std::endl; + row << '\n'; if (samples > 0) { @@ -552,6 +554,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) ++it) { std::ostringstream row; + row << std::setprecision(10); row << it->getName(); const char* unit_label = it->getUnitLabel(); @@ -562,13 +565,13 @@ void LLSceneMonitor::dumpToFile(std::string file_name) S32 samples = 0; - for (S32 frame = 0; frame < frame_count; frame++) + for (S32 frame = 1; frame <= frame_count; frame++) { samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it); row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it); } - row << std::endl; + row << '\n'; if (samples > 0) { @@ -583,6 +586,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) ++it) { std::ostringstream row; + row << std::setprecision(10); row << it->getName(); const char* unit_label = it->getUnitLabel(); @@ -593,13 +597,13 @@ void LLSceneMonitor::dumpToFile(std::string file_name) S32 samples = 0; - for (S32 frame = 0; frame < frame_count; frame++) + for (S32 frame = 1; frame <= frame_count; frame++) { samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it); row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it); } - row << std::endl; + row << '\n'; if (samples > 0) { @@ -614,12 +618,12 @@ void LLSceneMonitor::dumpToFile(std::string file_name) { os << it->getName() << "(KiB)"; - for (S32 frame = 0; frame < frame_count; frame++) + for (S32 frame = 1; frame <= frame_count; frame++) { os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).getAs(); } - os << std::endl; + os << '\n'; } os.flush(); -- cgit v1.2.3 From 8bddaeec6647e735415f9bd72a4e1313e11fe720 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sat, 22 Jun 2013 12:00:18 -0700 Subject: fixed scene load monitor resetting to eagerly due to spurious camer amotion pulled swap() out of ui time block cleaned up internal lltrace dependencies, factored out common accumulator definitions --- indra/newview/llscenemonitor.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index ed9eeb9330..a4d693ec0b 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -260,14 +260,7 @@ void LLSceneMonitor::capture() static LLCachedControl monitor_enabled(gSavedSettings, "SceneLoadingMonitorEnabled"); static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); static LLFrameTimer timer; - - if (mEnabled - && (mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f - || mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f)) - { - reset(); - freezeScene(); - } + static bool force_capture = true; bool enabled = monitor_enabled || mDebugViewerVisible; if(mEnabled != enabled) @@ -275,6 +268,7 @@ void LLSceneMonitor::capture() if(mEnabled) { unfreezeScene(); + force_capture = true; } else { @@ -285,11 +279,23 @@ void LLSceneMonitor::capture() mEnabled = enabled; } - if(timer.getElapsedTimeF32() > scene_load_sample_time() + if (mEnabled + && (mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f + || mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f)) + { + reset(); + freezeScene(); + force_capture = true; + } + + if((timer.getElapsedTimeF32() > scene_load_sample_time() + || force_capture) && mEnabled && LLGLSLShader::sNoFixedFunction && last_capture_time != gFrameCount) { + force_capture = false; + mSceneLoadRecording.resume(); mMonitorRecording.resume(); @@ -479,12 +485,10 @@ void LLSceneMonitor::fetchQueryResult() if(mDiffResult > diff_threshold()) { mSceneLoadRecording.extend(); - llassert(mSceneLoadRecording.getAcceptedRecording().getLastRecording().getSum(LLStatViewer::FPS)); } else { mSceneLoadRecording.getPotentialRecording().nextPeriod(); - llassert(mSceneLoadRecording.getPotentialRecording().getLastRecording().getSum(LLStatViewer::FPS)); } } } -- cgit v1.2.3 From ffa7123bb5187e1da491a8f475d696053d9c9ee4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 28 Jun 2013 20:45:20 -0700 Subject: SH-4299 FIX Interesting: High fps shown temporarily off scale in statistics console added ability to force uniqueness of LLCopyOnWritePointer converted more variables to units added convenience function for unit constants --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index a4d693ec0b..342b45863a 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -624,7 +624,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) for (S32 frame = 1; frame <= frame_count; frame++) { - os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).getAs(); + os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).valueAs(); } os << '\n'; -- cgit v1.2.3 From 11e14cd3b0f58225a96b9b7a9839a7f030fe4045 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 15 Jul 2013 11:05:57 -0700 Subject: SH-4299Interesting: High fps shown temporarily off scale in statistics console various fixes to lltrace start() on started recording no longer resets fixed various instances of unit forgetfullness in lltrace recording split now has gapless timing scene monitor now guarantees min sample time renamed a bunch of stats added names to debug thread view on windows --- indra/newview/llscenemonitor.cpp | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 342b45863a..eec4a703a1 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -256,7 +256,7 @@ void LLSceneMonitor::unfreezeScene() void LLSceneMonitor::capture() { - static U32 last_capture_time = 0; + static U32 last_capture_frame = 0; static LLCachedControl monitor_enabled(gSavedSettings, "SceneLoadingMonitorEnabled"); static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); static LLFrameTimer timer; @@ -268,11 +268,11 @@ void LLSceneMonitor::capture() if(mEnabled) { unfreezeScene(); + reset(); force_capture = true; } else { - reset(); freezeScene(); } @@ -280,8 +280,8 @@ void LLSceneMonitor::capture() } if (mEnabled - && (mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f - || mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f)) + && (mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f + || mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f)) { reset(); freezeScene(); @@ -290,9 +290,10 @@ void LLSceneMonitor::capture() if((timer.getElapsedTimeF32() > scene_load_sample_time() || force_capture) + && mDiffState == WAITING_FOR_NEXT_DIFF && mEnabled && LLGLSLShader::sNoFixedFunction - && last_capture_time != gFrameCount) + && last_capture_frame != gFrameCount) { force_capture = false; @@ -301,7 +302,7 @@ void LLSceneMonitor::capture() timer.reset(); - last_capture_time = gFrameCount; + last_capture_frame = gFrameCount; LLRenderTarget& cur_target = getCaptureTarget(); @@ -465,7 +466,11 @@ void LLSceneMonitor::fetchQueryResult() { LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); - if(mDiffState == WAIT_ON_RESULT) + // also throttle timing here, to avoid going below sample time due to phasing with frame capture + static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); + static LLFrameTimer timer; + + if(mDiffState == WAIT_ON_RESULT && timer.getElapsedTimeF32() > scene_load_sample_time) { mDiffState = WAITING_FOR_NEXT_DIFF; @@ -479,7 +484,7 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; - record(sFramePixelDiff, mDiffResult); + record(sFramePixelDiff, sqrtf(mDiffResult)); static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); if(mDiffResult > diff_threshold()) @@ -488,7 +493,7 @@ void LLSceneMonitor::fetchQueryResult() } else { - mSceneLoadRecording.getPotentialRecording().nextPeriod(); + mSceneLoadRecording.nextPeriod(); } } } @@ -506,7 +511,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) os << std::setprecision(10); - PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording(); + PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); LLUnit frame_time; @@ -519,6 +524,15 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } os << '\n'; + os << "Sample period(s)"; + for (S32 frame = 1; frame <= frame_count; frame++) + { + frame_time = scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); + os << ", " << frame_time.value(); + } + os << '\n'; + + typedef TraceType trace_count; for (trace_count::instance_iter it = trace_count::beginInstances(), end_it = trace_count::endInstances(); it != end_it; @@ -697,7 +711,7 @@ void LLSceneMonitorView::draw() LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); lines++; - num_str = llformat("Scene Loading time: %.3f seconds", (F32)LLSceneMonitor::getInstance()->getRecording()->getAcceptedRecording().getDuration().value()); + num_str = llformat("Scene Loading time: %.3f seconds", (F32)LLSceneMonitor::getInstance()->getRecording()->getResults().getDuration().value()); LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); lines++; -- cgit v1.2.3 From bd078122e3a87e958fb6b0ea9caeef885298d527 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 15 Jul 2013 21:00:19 -0700 Subject: SH-4299 FIX: Interesting: High fps shown temporarily off scale in statistics console timing of scene load recording extension now guaranteed > requested time step removed double add of recorded data removed spam --- indra/newview/llscenemonitor.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index eec4a703a1..2f48be12fb 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -290,7 +290,6 @@ void LLSceneMonitor::capture() if((timer.getElapsedTimeF32() > scene_load_sample_time() || force_capture) - && mDiffState == WAITING_FOR_NEXT_DIFF && mEnabled && LLGLSLShader::sNoFixedFunction && last_capture_frame != gFrameCount) @@ -470,7 +469,8 @@ void LLSceneMonitor::fetchQueryResult() static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); static LLFrameTimer timer; - if(mDiffState == WAIT_ON_RESULT && timer.getElapsedTimeF32() > scene_load_sample_time) + F32 elapsed_time = timer.getElapsedTimeF32(); + if(mDiffState == WAIT_ON_RESULT && elapsed_time > scene_load_sample_time) { mDiffState = WAITING_FOR_NEXT_DIFF; @@ -481,21 +481,24 @@ void LLSceneMonitor::fetchQueryResult() GLuint count = 0; glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); - mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) + mDiffResult = sqrtf(count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio)); //0.5 -> (front face + back face) LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; - record(sFramePixelDiff, sqrtf(mDiffResult)); + record(sFramePixelDiff, mDiffResult); static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); if(mDiffResult > diff_threshold()) { mSceneLoadRecording.extend(); + llassert(mSceneLoadRecording.getResults().getLastRecording().getDuration() > scene_load_sample_time); } else { mSceneLoadRecording.nextPeriod(); } } + + timer.reset(); } } -- cgit v1.2.3 From 29930baf23fbd8cd147cd78f60d01496479ae78e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 17 Jul 2013 10:56:47 -0700 Subject: SH-4299 WIP: Interesting: High fps shown temporarily off scale in statistics console made unit types work with ostreams fixed timing of scene monitor recordings to better respect requested time diff --- indra/newview/llscenemonitor.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 2f48be12fb..3f4f872174 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -469,8 +469,8 @@ void LLSceneMonitor::fetchQueryResult() static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); static LLFrameTimer timer; - F32 elapsed_time = timer.getElapsedTimeF32(); - if(mDiffState == WAIT_ON_RESULT && elapsed_time > scene_load_sample_time) + if(mDiffState == WAIT_ON_RESULT + && !LLAppViewer::instance()->quitRequested()) { mDiffState = WAITING_FOR_NEXT_DIFF; @@ -487,14 +487,20 @@ void LLSceneMonitor::fetchQueryResult() record(sFramePixelDiff, mDiffResult); static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); - if(mDiffResult > diff_threshold()) - { - mSceneLoadRecording.extend(); - llassert(mSceneLoadRecording.getResults().getLastRecording().getDuration() > scene_load_sample_time); - } - else + F32 elapsed_time = timer.getElapsedTimeF32(); + + if (elapsed_time > scene_load_sample_time) { - mSceneLoadRecording.nextPeriod(); + if(mDiffResult > diff_threshold()) + { + mSceneLoadRecording.extend(); + llinfos << mSceneLoadRecording.getResults().getLastRecording().getDuration() << llendl; + llassert_always(mSceneLoadRecording.getResults().getLastRecording().getDuration() > scene_load_sample_time); + } + else + { + mSceneLoadRecording.nextPeriod(); + } } } -- cgit v1.2.3 From e40065f82c797eab41006a448c838f4f1089a2e8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 19 Jul 2013 15:03:05 -0700 Subject: BUILDFIX: #include and dependency cleanup --- indra/newview/llscenemonitor.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 3f4f872174..29dd140158 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -89,6 +89,7 @@ void LLSceneMonitor::reset() mMonitorRecording.reset(); mSceneLoadRecording.reset(); + mRecordingTimer.reset(); unfreezeScene(); @@ -259,7 +260,6 @@ void LLSceneMonitor::capture() static U32 last_capture_frame = 0; static LLCachedControl monitor_enabled(gSavedSettings, "SceneLoadingMonitorEnabled"); static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); - static LLFrameTimer timer; static bool force_capture = true; bool enabled = monitor_enabled || mDebugViewerVisible; @@ -288,7 +288,7 @@ void LLSceneMonitor::capture() force_capture = true; } - if((timer.getElapsedTimeF32() > scene_load_sample_time() + if((mRecordingTimer.getElapsedTimeF32() > scene_load_sample_time() || force_capture) && mEnabled && LLGLSLShader::sNoFixedFunction @@ -299,8 +299,6 @@ void LLSceneMonitor::capture() mSceneLoadRecording.resume(); mMonitorRecording.resume(); - timer.reset(); - last_capture_frame = gFrameCount; LLRenderTarget& cur_target = getCaptureTarget(); @@ -467,7 +465,6 @@ void LLSceneMonitor::fetchQueryResult() // also throttle timing here, to avoid going below sample time due to phasing with frame capture static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); - static LLFrameTimer timer; if(mDiffState == WAIT_ON_RESULT && !LLAppViewer::instance()->quitRequested()) @@ -483,11 +480,11 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = sqrtf(count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio)); //0.5 -> (front face + back face) - LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; + LL_DEBUGS("SceneMonitor") << "Frame difference: " << mDiffResult << LL_ENDL; record(sFramePixelDiff, mDiffResult); static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); - F32 elapsed_time = timer.getElapsedTimeF32(); + F32 elapsed_time = mRecordingTimer.getElapsedTimeF32(); if (elapsed_time > scene_load_sample_time) { @@ -501,10 +498,9 @@ void LLSceneMonitor::fetchQueryResult() { mSceneLoadRecording.nextPeriod(); } + mRecordingTimer.reset(); } } - - timer.reset(); } } -- cgit v1.2.3 From 4ff19b8f63f3814e98049064254323716f0fd422 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sat, 20 Jul 2013 09:41:55 -0700 Subject: removed debug spam fast timer data now resets on login --- indra/newview/llscenemonitor.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 29dd140158..022a950ece 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -491,7 +491,6 @@ void LLSceneMonitor::fetchQueryResult() if(mDiffResult > diff_threshold()) { mSceneLoadRecording.extend(); - llinfos << mSceneLoadRecording.getResults().getLastRecording().getDuration() << llendl; llassert_always(mSceneLoadRecording.getResults().getLastRecording().getDuration() > scene_load_sample_time); } else -- cgit v1.2.3 From bd5808765f7a74226d312afbb863c471528b8d1a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 31 Jul 2013 19:32:50 -0700 Subject: cleanup - renamed valueAs to valueInUnits and made it a symmetrical getter/setter --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 022a950ece..7fdee2b2ad 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -642,7 +642,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) for (S32 frame = 1; frame <= frame_count; frame++) { - os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).valueAs(); + os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).valueInUnits(); } os << '\n'; -- cgit v1.2.3 From d65243063c42b6df809873e917259e7db8d21ed4 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 31 Jul 2013 21:21:58 -0600 Subject: fix for SH-4290: Running viewer with SceneLoadingMonitorEnabled causes viewer to be unresponsive on login on low end machine --- indra/newview/llscenemonitor.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 022a950ece..918b2271d1 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -211,11 +211,19 @@ LLRenderTarget& LLSceneMonitor::getCaptureTarget() void LLSceneMonitor::freezeAvatar(LLCharacter* avatarp) { - mAvatarPauseHandles.push_back(avatarp->requestPause()); + if(mEnabled) + { + mAvatarPauseHandles.push_back(avatarp->requestPause()); + } } void LLSceneMonitor::freezeScene() { + if(!mEnabled) + { + return; + } + //freeze all avatars for (std::vector::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) @@ -262,7 +270,7 @@ void LLSceneMonitor::capture() static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); static bool force_capture = true; - bool enabled = monitor_enabled || mDebugViewerVisible; + bool enabled = LLGLSLShader::sNoFixedFunction && (monitor_enabled || mDebugViewerVisible); if(mEnabled != enabled) { if(mEnabled) @@ -288,10 +296,9 @@ void LLSceneMonitor::capture() force_capture = true; } - if((mRecordingTimer.getElapsedTimeF32() > scene_load_sample_time() + if(mEnabled + && (mRecordingTimer.getElapsedTimeF32() > scene_load_sample_time() || force_capture) - && mEnabled - && LLGLSLShader::sNoFixedFunction && last_capture_frame != gFrameCount) { force_capture = false; -- cgit v1.2.3 From 26581404e426b00cd0a07c38b5cb858d5d5faa28 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 14 Aug 2013 11:51:49 -0700 Subject: BUILDFIX: added header for numeric_limits support on gcc added convenience types for units F32Seconds, etc. --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index f0c7a220a4..d16c2d3984 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -525,7 +525,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); - LLUnit frame_time; + LLUnits::F64Seconds frame_time; os << "Stat"; for (S32 frame = 1; frame <= frame_count; frame++) -- cgit v1.2.3 From 9f7bfa1c3710856cd2b0a0a8a429d6c45b0fcd09 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 15 Aug 2013 00:02:23 -0700 Subject: moved unit types out of LLUnits namespace, since they are prefixed --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index d16c2d3984..ecee801e8e 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -525,7 +525,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); - LLUnits::F64Seconds frame_time; + F64Seconds frame_time; os << "Stat"; for (S32 frame = 1; frame <= frame_count; frame++) -- cgit v1.2.3 From 612892b45a3413b16e40c49d3bfde77a4ca927fd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 18 Aug 2013 22:30:27 -0700 Subject: SH-4433 WIP: Interesting: Statistics > Ping Sim is always 0 ms continued conversion to units system made units perform type promotion correctly and preserve type in arithmetic e.g. can now do LLVector3 in units added typedefs for remaining common unit types, including implicits --- indra/newview/llscenemonitor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index ecee801e8e..7fafabb493 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -471,7 +471,8 @@ void LLSceneMonitor::fetchQueryResult() LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); // also throttle timing here, to avoid going below sample time due to phasing with frame capture - static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); + static LLCachedControl scene_load_sample_time_control(gSavedSettings, "SceneLoadingMonitorSampleTime"); + F32Seconds scene_load_sample_time = (F32Seconds)scene_load_sample_time_control(); if(mDiffState == WAIT_ON_RESULT && !LLAppViewer::instance()->quitRequested()) @@ -491,7 +492,7 @@ void LLSceneMonitor::fetchQueryResult() record(sFramePixelDiff, mDiffResult); static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); - F32 elapsed_time = mRecordingTimer.getElapsedTimeF32(); + F32Seconds elapsed_time = mRecordingTimer.getElapsedTimeF32(); if (elapsed_time > scene_load_sample_time) { @@ -649,7 +650,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) for (S32 frame = 1; frame <= frame_count; frame++) { - os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).valueInUnits(); + os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).valueInUnits(); } os << '\n'; -- cgit v1.2.3 From 8535b87544cc2e71896716a4cd1c3c2445ff4af0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 26 Aug 2013 18:00:24 -0700 Subject: removed some unecessary template parameters from LLUnit member functions forced unit conversion code to inline unit conversion now no longer converts all the way to base and back, but tries to find equivalent units as early as possible fixed another llinfos instance scene monitor now outputs n/a for invalid samples --- indra/newview/llscenemonitor.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 7fafabb493..57d58a9d4e 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -565,8 +565,9 @@ void LLSceneMonitor::dumpToFile(std::string file_name) for (S32 frame = 1; frame <= frame_count; frame++) { - samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it); - row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getSum(*it); + Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); + samples += recording.getSampleCount(*it); + row << ", " << recording.getSum(*it); } row << '\n'; @@ -597,8 +598,17 @@ void LLSceneMonitor::dumpToFile(std::string file_name) for (S32 frame = 1; frame <= frame_count; frame++) { - samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it); - row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it); + Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); + samples += recording.getSampleCount(*it); + F64 mean = recording.getMean(*it); + if (llisnan(mean)) + { + row << ", n/a"; + } + else + { + row << ", " << mean; + } } row << '\n'; @@ -629,8 +639,17 @@ void LLSceneMonitor::dumpToFile(std::string file_name) for (S32 frame = 1; frame <= frame_count; frame++) { - samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it); - row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it); + Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); + samples += recording.getSampleCount(*it); + F64 mean = recording.getMean(*it); + if (llisnan(mean)) + { + row << ", n/a"; + } + else + { + row << ", " << mean; + } } row << '\n'; -- cgit v1.2.3 From bf99887cbb8d69b5f29d18566ad082d2d0109e9c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Aug 2013 19:32:26 -0700 Subject: SH-4453 FIX: Interesting: SceneLoadingMonitorEnabled does not work until the camera turns set enabled flag before calling freeze scene --- indra/newview/llscenemonitor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 57d58a9d4e..ecffc67993 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -274,17 +274,17 @@ void LLSceneMonitor::capture() if(mEnabled != enabled) { if(mEnabled) - { + { + mEnabled = enabled; unfreezeScene(); reset(); force_capture = true; } else { + mEnabled = enabled; freezeScene(); } - - mEnabled = enabled; } if (mEnabled -- cgit v1.2.3 From f0a642898dad11f6519bad735857a58e1d83422e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 29 Aug 2013 15:25:48 -0700 Subject: SH-4377 FIX: Interesting: Windows viewer crashes when SceneLoadingMonitorEnabled is enabled --- indra/newview/llscenemonitor.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index ecffc67993..666fb1a0e5 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -283,6 +283,7 @@ void LLSceneMonitor::capture() else { mEnabled = enabled; + reset(); freezeScene(); } } -- cgit v1.2.3 From cbe397ad13665c7bc993e10d8fe1e4a876253378 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 5 Sep 2013 14:04:13 -0700 Subject: changed fast timer over to using macro another attempt to move mem stat into base class --- indra/newview/llscenemonitor.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 666fb1a0e5..429d6a9258 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -331,8 +331,8 @@ bool LLSceneMonitor::needsUpdate() const return mDiffState == NEED_DIFF; } -static LLFastTimer::DeclareTimer FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE("Generate Scene Load Dither Texture"); -static LLFastTimer::DeclareTimer FTM_SCENE_LOAD_IMAGE_DIFF("Scene Load Image Diff"); +static LLTrace::TimeBlock FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE("Generate Scene Load Dither Texture"); +static LLTrace::TimeBlock FTM_SCENE_LOAD_IMAGE_DIFF("Scene Load Image Diff"); void LLSceneMonitor::compare() { @@ -350,14 +350,14 @@ void LLSceneMonitor::compare() return; } - LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + LL_RECORD_BLOCK_TIME(FTM_SCENE_LOAD_IMAGE_DIFF); mDiffState = EXECUTE_DIFF; S32 width = gViewerWindow->getWindowWidthRaw(); S32 height = gViewerWindow->getWindowHeightRaw(); if(!mDiff) { - LLFastTimer _(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); + LL_RECORD_BLOCK_TIME(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); mDiff = new LLRenderTarget(); mDiff->allocate(width, height, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true); @@ -365,7 +365,7 @@ void LLSceneMonitor::compare() } else if(mDiff->getWidth() != width || mDiff->getHeight() != height) { - LLFastTimer _(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); + LL_RECORD_BLOCK_TIME(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); mDiff->resize(width, height, GL_RGBA); generateDitheringTexture(width, height); } @@ -416,7 +416,7 @@ void LLSceneMonitor::compare() //calculate Diff aggregate information in GPU, and enable gl occlusion query to capture it. void LLSceneMonitor::calcDiffAggregate() { - LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + LL_RECORD_BLOCK_TIME(FTM_SCENE_LOAD_IMAGE_DIFF); if(mDiffState != EXECUTE_DIFF && !mDebugViewerVisible) { @@ -469,7 +469,7 @@ void LLSceneMonitor::calcDiffAggregate() static LLTrace::EventStatHandle<> sFramePixelDiff("FramePixelDifference"); void LLSceneMonitor::fetchQueryResult() { - LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + LL_RECORD_BLOCK_TIME(FTM_SCENE_LOAD_IMAGE_DIFF); // also throttle timing here, to avoid going below sample time due to phasing with frame capture static LLCachedControl scene_load_sample_time_control(gSavedSettings, "SceneLoadingMonitorSampleTime"); -- cgit v1.2.3 From 9bae912308a75cc1ceaec49d28b50f7119ec02ba Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 1 Oct 2013 17:18:35 -0700 Subject: BUILDFIX: old style fast timer use, broken unit test --- indra/newview/llscenemonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 429d6a9258..c1ebd1f435 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -202,7 +202,7 @@ LLRenderTarget& LLSceneMonitor::getCaptureTarget() if(cur_target->getWidth() != width || cur_target->getHeight() != height) //size changed { - cur_target->resize(width, height, GL_RGB); + cur_target->resize(width, height); } // we're promising the target exists @@ -366,7 +366,7 @@ void LLSceneMonitor::compare() else if(mDiff->getWidth() != width || mDiff->getHeight() != height) { LL_RECORD_BLOCK_TIME(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); - mDiff->resize(width, height, GL_RGBA); + mDiff->resize(width, height); generateDitheringTexture(width, height); } -- cgit v1.2.3 From 17df8988fec3f2ba991ca9e34ff8148253a2fc04 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 7 Oct 2013 13:38:03 -0700 Subject: renamed TraceType to StatType added more MemTrackable types optimized memory usage of LLTrace some more --- indra/newview/llscenemonitor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index c1ebd1f435..db2936b1fd 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -546,7 +546,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) os << '\n'; - typedef TraceType trace_count; + typedef StatType trace_count; for (trace_count::instance_iter it = trace_count::beginInstances(), end_it = trace_count::endInstances(); it != end_it; ++it) @@ -579,7 +579,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - typedef TraceType trace_event; + typedef StatType trace_event; for (trace_event::instance_iter it = trace_event::beginInstances(), end_it = trace_event::endInstances(); it != end_it; @@ -620,7 +620,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - typedef TraceType trace_sample; + typedef StatType trace_sample; for (trace_sample::instance_iter it = trace_sample::beginInstances(), end_it = trace_sample::endInstances(); it != end_it; @@ -661,7 +661,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name) } } - typedef TraceType trace_mem; + typedef StatType trace_mem; for (trace_mem::instance_iter it = trace_mem::beginInstances(), end_it = trace_mem::endInstances(); it != end_it; ++it) -- cgit v1.2.3 From 697d2e720ba75e142a4d56ae8794bab8d7698dad Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 15 Oct 2013 20:24:42 -0700 Subject: renamed TimeBlock to BlockTimerStatHandle --- indra/newview/llscenemonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 142cda87a4..6c35ae2672 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -331,8 +331,8 @@ bool LLSceneMonitor::needsUpdate() const return mDiffState == NEED_DIFF; } -static LLTrace::TimeBlock FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE("Generate Scene Load Dither Texture"); -static LLTrace::TimeBlock FTM_SCENE_LOAD_IMAGE_DIFF("Scene Load Image Diff"); +static LLTrace::BlockTimerStatHandle FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE("Generate Scene Load Dither Texture"); +static LLTrace::BlockTimerStatHandle FTM_SCENE_LOAD_IMAGE_DIFF("Scene Load Image Diff"); static LLStaticHashedString sDitherScale("dither_scale"); static LLStaticHashedString sDitherScaleS("dither_scale_s"); -- cgit v1.2.3 From 6ddfc8031c73f342cf8459445a20cd50ceb3efba Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 12 Nov 2013 11:42:06 -0800 Subject: BUILDFIX - miscellaneous stuff missed in the merge --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 6c35ae2672..44ab35420b 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -699,7 +699,7 @@ LLSceneMonitorView::LLSceneMonitorView(const LLRect& rect) setCanClose(true); } -void LLSceneMonitorView::onClickCloseBtn() +void LLSceneMonitorView::onClose(bool app_quitting) { setVisible(false); } -- cgit v1.2.3 From 5be20dd02415462991b26fb1aadf595a129661de Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 13 Nov 2013 16:18:59 -0800 Subject: moved SceneLoadingMonitor settings vars (and renamed SceneLoadingPixelDiffThreshold to SceneLoadingMonitorPixelDiffThreshold) tweaked layout of floater_model_preview.xml --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 44ab35420b..77f53616cd 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -498,7 +498,7 @@ void LLSceneMonitor::fetchQueryResult() LL_DEBUGS("SceneMonitor") << "Frame difference: " << mDiffResult << LL_ENDL; record(sFramePixelDiff, mDiffResult); - static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); + static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingMonitorPixelDiffThreshold"); F32Seconds elapsed_time = mRecordingTimer.getElapsedTimeF32(); if (elapsed_time > scene_load_sample_time) -- cgit v1.2.3 From dbfb429bd1800d84d21670addb02745a3030573e Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 21 Nov 2013 15:32:57 -0700 Subject: fix for SH-4628: Project Interesting Viewer reduces & fixes graphics to lowest settings on a MAC --- indra/newview/llscenemonitor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llscenemonitor.cpp') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 77f53616cd..7f705e44d2 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -340,6 +340,7 @@ static LLStaticHashedString sDitherScaleT("dither_scale_t"); void LLSceneMonitor::compare() { +#ifdef LL_WINDOWS if(mDiffState != NEED_DIFF) { return; @@ -415,6 +416,7 @@ void LLSceneMonitor::compare() { calcDiffAggregate(); } +#endif } static LLStaticHashedString sTolerance("tolerance"); @@ -422,6 +424,8 @@ static LLStaticHashedString sTolerance("tolerance"); //calculate Diff aggregate information in GPU, and enable gl occlusion query to capture it. void LLSceneMonitor::calcDiffAggregate() { +#ifdef LL_WINDOWS + LL_RECORD_BLOCK_TIME(FTM_SCENE_LOAD_IMAGE_DIFF); if(mDiffState != EXECUTE_DIFF && !mDebugViewerVisible) @@ -469,7 +473,8 @@ void LLSceneMonitor::calcDiffAggregate() if(!mDebugViewerVisible) { glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - } + } +#endif } static LLTrace::EventStatHandle<> sFramePixelDiff("FramePixelDifference"); -- cgit v1.2.3