diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2012-04-26 15:53:35 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2012-04-26 15:53:35 -0600 |
commit | e344b2afa21adf072837f1bcf4b38dd511b76f0e (patch) | |
tree | 62575d52d289fa24e111e33e16a584e3675bb8a0 /indra/newview/lltexturefetch.cpp | |
parent | 5ab4dadc703a0f7419929c7da57c471f2ece8a6c (diff) |
For SH-3121: collect time of reloading all textures from cache and through HTTP when all objects loading are done.
Diffstat (limited to 'indra/newview/lltexturefetch.cpp')
-rwxr-xr-x | indra/newview/lltexturefetch.cpp | 83 |
1 files changed, 81 insertions, 2 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index d7742219bf..2816c16261 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -3139,6 +3139,8 @@ void LLTextureFetchDebugger::init() mHTTPTime = -1.f; mGLCreationTime = -1.f; mTotalFetchingTime = 0.f; + mRefetchVisCacheTime = -1.f; + mRefetchVisHTTPTime = -1.f; mNumFetchedTextures = 0; mNumCacheHits = 0; @@ -3150,12 +3152,19 @@ void LLTextureFetchDebugger::init() mVisibleDecodedData = 0; mRenderedData = 0; mRenderedDecodedData = 0; + mFetchedPixels = 0; + mRenderedPixels = 0; + mRefetchedData = 0; + mRefetchedPixels = 0; + + mFreezeHistory = FALSE; } void LLTextureFetchDebugger::startDebug() { //lock the fetcher mFetcher->lockFetcher(true); + mFreezeHistory = TRUE; //clear the current fetching queue gTextureList.clearFetchingRequests(); @@ -3203,6 +3212,7 @@ void LLTextureFetchDebugger::startDebug() { mRenderedData += mFetchingHistory[i].mFetchedSize; mRenderedDecodedData += mFetchingHistory[i].mDecodedSize; + mRenderedPixels += tex->getWidth() * tex->getHeight(); } } } @@ -3254,6 +3264,8 @@ void LLTextureFetchDebugger::stopDebug() //unlock the fetcher mFetcher->lockFetcher(false); + mFreezeHistory = FALSE; + mTotalFetchingTime = gDebugTimers[0].getElapsedTimeF32(); //reset } //called in the main thread and when the fetching queue is empty @@ -3265,12 +3277,20 @@ void LLTextureFetchDebugger::clearHistory() void LLTextureFetchDebugger::addHistoryEntry(LLTextureFetchWorker* worker) { + if(mFreezeHistory) + { + mRefetchedPixels += worker->mRawImage->getWidth() * worker->mRawImage->getHeight(); + mRefetchedData += worker->mFormattedImage->getDataSize(); + return; + } + if(worker->mInCache) { mNumCacheHits++; } mFetchedData += worker->mFormattedImage->getDataSize(); mDecodedData += worker->mRawImage->getDataSize(); + mFetchedPixels += worker->mRawImage->getWidth() * worker->mRawImage->getHeight(); mFetchingHistory.push_back(FetchEntry(worker->mID, worker->mDecodedDiscard, worker->mFormattedImage->getDataSize(), worker->mRawImage->getDataSize())); //mFetchingHistory.push_back(FetchEntry(worker->mID, worker->mDesiredSize, worker->mHaveAllData ? 0 : worker->mLoadedDiscard, worker->mFormattedImage->getComponents(), @@ -3301,9 +3321,8 @@ void LLTextureFetchDebugger::debugCacheRead() } } -void LLTextureFetchDebugger::debugCacheWrite() +void LLTextureFetchDebugger::clearCache() { - //remove from cache S32 size = mFetchingHistory.size(); { std::set<LLUUID> deleted_list; @@ -3316,12 +3335,19 @@ void LLTextureFetchDebugger::debugCacheWrite() } } } +} + +void LLTextureFetchDebugger::debugCacheWrite() +{ + //remove from cache + clearCache(); lockCache(); llassert_always(mState == IDLE); mTimer.reset(); mState = WRITE_CACHE; + S32 size = mFetchingHistory.size(); for(S32 i = 0 ; i < size ; i++) { mFetchingHistory[i].mCacheHandle = mTextureCache->writeToCache(mFetchingHistory[i].mID, LLWorkerThread::PRIORITY_NORMAL, @@ -3403,6 +3429,43 @@ void LLTextureFetchDebugger::debugGLTextureCreation() return; } +//clear fetching results of all textures. +void LLTextureFetchDebugger::clearTextures() +{ + S32 size = mFetchingHistory.size(); + for(S32 i = 0 ; i < size ; i++) + { + LLViewerFetchedTexture* tex = gTextureList.findImage(mFetchingHistory[i].mID) ; + if(tex) + { + tex->clearFetchedResults() ; + } + } +} + +void LLTextureFetchDebugger::debugRefetchVisibleFromCache() +{ + llassert_always(mState == IDLE); + mState = REFETCH_VIS_CACHE; + + clearTextures(); + + mTimer.reset(); + mFetcher->lockFetcher(false); +} + +void LLTextureFetchDebugger::debugRefetchVisibleFromHTTP() +{ + llassert_always(mState == IDLE); + mState = REFETCH_VIS_HTTP; + + clearCache(); + clearTextures(); + + mTimer.reset(); + mFetcher->lockFetcher(false); +} + bool LLTextureFetchDebugger::update() { switch(mState) @@ -3437,6 +3500,22 @@ bool LLTextureFetchDebugger::update() case GL_TEX: mState = IDLE; break; + case REFETCH_VIS_CACHE: + if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) + { + mRefetchVisCacheTime = gDebugTimers[0].getElapsedTimeF32() - mTotalFetchingTime; + mState = IDLE; + mFetcher->lockFetcher(true); + } + break; + case REFETCH_VIS_HTTP: + if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) + { + mRefetchVisHTTPTime = gDebugTimers[0].getElapsedTimeF32() - mTotalFetchingTime; + mState = IDLE; + mFetcher->lockFetcher(true); + } + break; default: mState = IDLE; break; |