diff options
author | Monty Brandenberg <monty@lindenlab.com> | 2010-11-24 16:46:40 -0500 |
---|---|---|
committer | Monty Brandenberg <monty@lindenlab.com> | 2010-11-24 16:46:40 -0500 |
commit | 0fd80d09972657e6417193abf577084a3b3b85f1 (patch) | |
tree | a59781ed3dbcdfebbae13d008fc68d51c924e01b /indra/newview | |
parent | 6abc60be577bd29c2428d85143c8f583eab54723 (diff) |
ESC-154 ESC-156 Metrics integration across threads
Using unpause() method in derived class rather than wake() in furthest base class
solved the stalling problem. I still think too many levels of the
LLTextureFetch hierarchy are keeping thread state, however. The
LLViewerRegion instance an agent enters doesn't necessarily have its
region_id yet, that only comes after the handshake, if any. So add
a few more metrics insertion points to propagate region into metrics.
Finally, try to launch a final metrics report when a quit is initiated.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 2 | ||||
-rw-r--r-- | indra/newview/lltexturefetch.cpp | 37 | ||||
-rw-r--r-- | indra/newview/lltexturefetch.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewerregion.cpp | 8 |
5 files changed, 33 insertions, 20 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 86fba90ff7..bf79523078 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2932,6 +2932,7 @@ void LLAppViewer::requestQuit() LLSideTray::getInstance()->notifyChildren(LLSD().with("request","quit")); send_stats(); + metricsSend(!gDisconnected); gLogoutTimer.reset(); mQuitRequested = true; @@ -3719,7 +3720,7 @@ void LLAppViewer::idle() // *TODO: Add configuration controls for this if (report_interval.getElapsedTimeF32() >= app_metrics_interval) { - metricsIdle(! gDisconnected); + metricsSend(! gDisconnected); report_interval.reset(); } } @@ -4601,7 +4602,7 @@ void LLAppViewer::metricsUpdateRegion(const LLUUID & region_id) * Attempts to start a multi-threaded metrics report to be sent back to * the grid for consumption. */ -void LLAppViewer::metricsIdle(bool enable_reporting) +void LLAppViewer::metricsSend(bool enable_reporting) { if (! gViewerAssetStatsMain) return; diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 909f191ab1..27c104626a 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -170,7 +170,7 @@ public: // Metrics policy helper statics. static void metricsUpdateRegion(const LLUUID & region_id); - static void metricsIdle(bool enable_reporting); + static void metricsSend(bool enable_reporting); protected: virtual bool initWindow(); // Initialize the viewer's window. diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 2e05a67791..2be3ba3280 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -2105,6 +2105,21 @@ bool LLTextureFetch::runCondition() ////////////////////////////////////////////////////////////////////////////// +// MAIN THREAD (unthreaded envs), WORKER THREAD (threaded envs) +void LLTextureFetch::commonUpdate() +{ + // Run a cross-thread command, if any. + cmdDoWork(); + + // Update Curl on same thread as mCurlGetRequest was constructed + S32 processed = mCurlGetRequest->process(); + if (processed > 0) + { + lldebugs << "processed: " << processed << " messages." << llendl; + } +} + + // MAIN THREAD //virtual S32 LLTextureFetch::update(U32 max_time_ms) @@ -2130,12 +2145,7 @@ S32 LLTextureFetch::update(U32 max_time_ms) if (!mThreaded) { - // Update Curl on same thread as mCurlGetRequest was constructed - S32 processed = mCurlGetRequest->process(); - if (processed > 0) - { - lldebugs << "processed: " << processed << " messages." << llendl; - } + commonUpdate(); } return res; @@ -2190,15 +2200,7 @@ void LLTextureFetch::threadedUpdate() } process_timer.reset(); - // Run a cross-thread command, if any. - cmdDoWork(); - - // Update Curl on same thread as mCurlGetRequest was constructed - S32 processed = mCurlGetRequest->process(); - if (processed > 0) - { - lldebugs << "processed: " << processed << " messages." << llendl; - } + commonUpdate(); #if 0 const F32 INFO_TIME = 1.0f; @@ -2657,6 +2659,7 @@ void LLTextureFetch::commandSetRegion(const LLUUID & region_id) TFReqSetRegion * req = new TFReqSetRegion(region_id); cmdEnqueue(req); + LL_INFOS("Texture") << "COMMANDING SET REGION" << LL_ENDL; } void LLTextureFetch::commandSendMetrics(const std::string & caps_url, @@ -2683,7 +2686,7 @@ void LLTextureFetch::cmdEnqueue(TFRequest * req) mCommands.push_back(req); unlockQueue(); - wake(); + unpause(); } TFRequest * LLTextureFetch::cmdDequeue() @@ -2818,7 +2821,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) LLViewerAssetStatsFF::merge_stats(main_stats, thread1_stats); // *TODO: Consider putting a report size limiter here. - + LL_INFOS("Texture") << "PROCESSING SENDMETRICS REQUEST" << LL_ENDL; if (! mCapsURL.empty()) { LLCurlRequest::headers_t headers; diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index d46d2da7bc..bad0a1498f 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -109,6 +109,7 @@ private: /*virtual*/ void startThread(void); /*virtual*/ void endThread(void); /*virtual*/ void threadedUpdate(void); + void commonUpdate(); // Metrics command helpers /** diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 79b45a459f..717ef40465 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1341,6 +1341,14 @@ void LLViewerRegion::unpackRegionHandshake() msg->nextBlock("RegionInfo"); msg->addU32("Flags", 0x0 ); msg->sendReliable(host); + + // Inform metrics when a region associated with an agent + // receives a regionID. + if (gAgent.getRegion() == this) + { + // Region is active in agent, tell metrics about the region ID + LLAppViewer::metricsUpdateRegion(region_id); + } } void LLViewerRegion::setSeedCapability(const std::string& url) |