From 6e437d4188e2e40bf152815595e824e320d5b14f Mon Sep 17 00:00:00 2001 From: Shyotl Date: Fri, 1 Apr 2011 17:19:23 -0500 Subject: [PATCH] Fixed texture console showing invalid values... Improved texture console progress bar visibility. Shoehorned sgblacklist for server response status 499 Restored stat recording for LLViewerTextureList Cleaned up lltexturefetch by excluding more unused code via #if --- indra/newview/lldebugview.cpp | 2 +- indra/newview/lltexturefetch.cpp | 47 ++++++++++++++++++--------- indra/newview/lltexturefetch.h | 8 +++-- indra/newview/lltextureview.cpp | 15 +++++---- indra/newview/llviewertexturelist.cpp | 12 +++---- 5 files changed, 53 insertions(+), 31 deletions(-) diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index eeeac9a93..8b2aac6e9 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -90,7 +90,7 @@ LLDebugView::LLDebugView(const std::string& name, const LLRect &rect) mMemoryView->setVisible(FALSE); // start invisible addChild(mMemoryView); - r.set(150, rect.getHeight() - 50, 820, 100); + r.set(150, rect.getHeight() - 50, 870, 100); gTextureView = new LLTextureView("gTextureView", r); gTextureView->setRect(r); gTextureView->setFollowsBottom(); diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 0af52ef16..aa3835c4c 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -472,6 +472,7 @@ public: LLMutex* SGHostBlackList::sMutex = 0; SGHostBlackList::blacklist_t SGHostBlackList::blacklist; +#if HTTP_METRICS // Cross-thread messaging for asset metrics. /** @@ -695,7 +696,7 @@ public: bool truncate_viewer_metrics(int max_regions, LLSD & metrics); } // end of anonymous namespace - +#endif ////////////////////////////////////////////////////////////////////////////// @@ -716,8 +717,10 @@ const char* LLTextureFetchWorker::sStateDescs[] = { "DONE", }; +#if HTTP_METRICS // static volatile bool LLTextureFetch::svMetricsDataBreak(true); // Start with a data break +#endif // called from MAIN THREAD @@ -1224,8 +1227,8 @@ bool LLTextureFetchWorker::doWork(S32 param) } else { -#if HTTP_METRICS mFetcher->addToNetworkQueue(this); // failsafe +#if HTTP_METRICS if (! mMetricsStartTime) { mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); @@ -1334,11 +1337,16 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mRequestedSize < 0) { S32 max_attempts; - if (mGetStatus == HTTP_NOT_FOUND) + if (mGetStatus == HTTP_NOT_FOUND || mGetStatus == 499) { mHTTPFailCount = max_attempts = 1; // Don't retry - llwarns << "Texture missing from server (404): " << mUrl << llendl; - + if(mGetStatus == HTTP_NOT_FOUND) + llwarns << "Texture missing from server (404): " << mUrl << llendl; + else if (mGetStatus == 499) + { + llwarns << "No response from server (499): " << mUrl << llendl; + SGHostBlackList::add(mUrl, 60.0, mGetStatus); + } //roll back to try UDP if(mCanUseNET) { @@ -1939,10 +1947,14 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image mTextureBandwidth(0), mHTTPTextureBits(0), mTotalHTTPRequests(0), - mCurlGetRequest(NULL), - mQAMode(qa_mode) + mCurlGetRequest(NULL) +#if HTTP_METRICS + ,mQAMode(qa_mode) +#endif { +#if HTTP_METRICS mCurlPOSTRequestCount = 0; +#endif mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); mTextureInfo.setUpLogging(gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog"), gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"), gSavedSettings.getU32("TextureLoggingThreshold")); } @@ -1951,12 +1963,14 @@ LLTextureFetch::~LLTextureFetch() { clearDeleteList() ; +#if HTTP_METRICS while (! mCommands.empty()) { TFRequest * req(mCommands.front()); mCommands.erase(mCommands.begin()); delete req; } +#endif // ~LLQueuedThread() called here } @@ -2259,8 +2273,10 @@ S32 LLTextureFetch::getPending() LLMutexLock lock(&mQueueMutex); res = mRequestQueue.size(); +#if HTTP_METRICS res += mCurlPOSTRequestCount; res += mCommands.size(); +#endif } unlockData(); return res; @@ -2278,6 +2294,7 @@ bool LLTextureFetch::runCondition() // // Changes here may need to be reflected in getPending(). +#if HTTP_METRICS bool have_no_commands(false); { LLMutexLock lock(&mQueueMutex); @@ -2290,6 +2307,9 @@ bool LLTextureFetch::runCondition() return ! (have_no_commands && have_no_curl_requests && (mRequestQueue.empty() && mIdleThread)); // From base class +#else + return !(mRequestQueue.empty() && mIdleThread); +#endif } ////////////////////////////////////////////////////////////////////////////// @@ -2297,9 +2317,11 @@ bool LLTextureFetch::runCondition() // MAIN THREAD (unthreaded envs), WORKER THREAD (threaded envs) void LLTextureFetch::commonUpdate() { +#if HTTP_METRICS // Run a cross-thread command, if any. cmdDoWork(); - +#endif + // Update Curl on same thread as mCurlGetRequest was constructed S32 processed = mCurlGetRequest->process(); if (processed > 0) @@ -2869,7 +2891,6 @@ void LLTextureFetch::commandDataBreak() LLTextureFetch::svMetricsDataBreak = true; } -#endif void LLTextureFetch::cmdEnqueue(TFRequest * req) { @@ -2927,14 +2948,11 @@ namespace bool TFReqSetRegion::doWork(LLTextureFetch *) { -#if HTTP_METRICS LLViewerAssetStatsFF::set_region_thread1(mRegionHandle); -#endif return true; } -#if HTTP_METRICS TFReqSendMetrics::~TFReqSendMetrics() { delete mMainStats; @@ -3076,8 +3094,6 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) return true; } -#endif - bool truncate_viewer_metrics(int max_regions, LLSD & metrics) @@ -3117,6 +3133,5 @@ truncate_viewer_metrics(int max_regions, LLSD & metrics) } } // end of anonymous namespace - - +#endif diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 71711fbda..6b84ffcd9 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -106,7 +106,6 @@ public: const LLUUID & agent_id, LLViewerAssetStats * main_stats); void commandDataBreak(); -#endif LLCurlRequest & getCurlRequest() { return *mCurlGetRequest; } @@ -115,6 +114,7 @@ public: // Curl POST counter maintenance inline void incrCurlPOSTCount() { mCurlPOSTRequestCount++; } inline void decrCurlPOSTCount() { mCurlPOSTRequestCount--; } +#endif protected: void addToNetworkQueue(LLTextureFetchWorker* worker); @@ -133,6 +133,7 @@ private: /*virtual*/ void threadedUpdate(void); void commonUpdate(); +#if HTTP_METRICS // Metrics command helpers /** * Enqueues a command request at the end of the command queue @@ -162,6 +163,7 @@ private: * Method locks the command queue. */ void cmdDoWork(); +#endif public: LLUUID mDebugID; @@ -197,6 +199,7 @@ private: //debug use U32 mTotalHTTPRequests ; +#if HTTP_METRICS // Out-of-band cross-thread command queue. This command queue // is logically tied to LLQueuedThread's list of // QueuedRequest instances and so must be covered by the @@ -213,12 +216,13 @@ private: // use the LLCurl module's request counter as it isn't thread compatible. // *NOTE: Don't mix Atomic and static, apr_initialize must be called first. LLAtomic32 mCurlPOSTRequestCount; - + public: // A probabilistically-correct indicator that the current // attempt to log metrics follows a break in the metrics stream // reporting due to either startup or a problem POSTing data. static volatile bool svMetricsDataBreak; +#endif }; #endif // LL_LLTEXTUREFETCH_H diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 751f21c79..d6a653998 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -73,7 +73,7 @@ static std::string title_string3("Pkt Bnd"); static std::string title_string4(" W x H (Dis) Mem"); static S32 title_x1 = 0; -static S32 title_x2 = 440; +static S32 title_x2 = 460; static S32 title_x3 = title_x2 + 40; static S32 title_x4 = title_x3 + 50; static S32 texture_bar_height = 8; @@ -182,7 +182,7 @@ void LLTextureBar::draw() // Various numerical stats. std::string tex_str; S32 left, right; - S32 top = 0; + S32 top = -2; S32 bottom = top + 6; LLColor4 clr; @@ -256,13 +256,15 @@ void LLTextureBar::draw() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Draw the progress bar. - S32 bar_width = 100; + S32 bar_width = 125; S32 bar_left = 330; left = bar_left; right = left + bar_width; gGL.color4f(0.f, 0.f, 0.f, 0.75f); gl_rect_2d(left, top, right, bottom); + gGL.color4f(.75f, .75f, .75f, 0.75f); + gl_rect_2d(left, top, right, bottom, false); F32 data_progress = mImagep->mDownloadProgress; @@ -272,7 +274,7 @@ void LLTextureBar::draw() right = left + llfloor(data_progress * (F32)bar_width); if (right > left) { - gGL.color4f(0.f, 0.f, 1.f, 0.75f); + gGL.color4f(.75f, .75f, .75f, 0.75f); gl_rect_2d(left, top, right, bottom); } } @@ -494,12 +496,13 @@ void LLGLTexMemBar::draw() #endif //---------------------------------------------------------------------------- - text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d IW:%d RAW:%d HTP:%d BW: %.0f/%.0f", + text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d IW:%d RAW:%d HTP:%d DEC:%d CRE:%d", gTextureList.getNumImages(), LLAppViewer::getTextureFetch()->getNumRequests(), LLAppViewer::getTextureFetch()->getNumDeletes(), LLAppViewer::getTextureFetch()->mPacketCount, LLAppViewer::getTextureFetch()->mBadPacketCount, LLAppViewer::getTextureCache()->getNumReads(), LLAppViewer::getTextureCache()->getNumWrites(), LLLFSThread::sLocal->getPending(), + LLAppViewer::getImageDecodeThread()->getPending(), LLImageRaw::sRawImageCount, LLAppViewer::getTextureFetch()->getNumHTTPRequests(), LLAppViewer::getImageDecodeThread()->getPending(), @@ -508,7 +511,7 @@ void LLGLTexMemBar::draw() LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*2, text_color, LLFontGL::LEFT, LLFontGL::TOP); - left = 600; + left = 650; F32 bandwidth = LLAppViewer::getTextureFetch()->getTextureBandwidth(); F32 max_bandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 2adbf0823..5867a94fd 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -585,12 +585,12 @@ void LLViewerTextureList::updateImages(F32 max_time) { LLAppViewer::getTextureFetch()->setTextureBandwidth(LLViewerStats::getInstance()->mTextureKBitStat.getMeanPerSec()); - /*LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages); - LLViewerStats::getInstance()->mNumRawImagesStat.addValue(LLImageRaw::sRawImageCount); - LLViewerStats::getInstance()->mGLTexMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sGlobalTextureMemoryInBytes)); - LLViewerStats::getInstance()->mGLBoundMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sBoundTextureMemoryInBytes)); - LLViewerStats::getInstance()->mRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageRaw::sGlobalRawMemory)); - LLViewerStats::getInstance()->mFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory));*/ + sNumImagesStat.addValue(sNumImages); + sNumRawImagesStat.addValue(LLImageRaw::sRawImageCount); + sGLTexMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sGlobalTextureMemoryInBytes)); + sGLBoundMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sBoundTextureMemoryInBytes)); + sRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageRaw::sGlobalRawMemory)); + sFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory)); updateImagesDecodePriorities();