From 9ec3334184c71879c2f8bd0f27095b71c4302559 Mon Sep 17 00:00:00 2001 From: Monty Brandenberg Date: Tue, 23 Nov 2010 13:31:22 -0500 Subject: ESC-154 ESC-156 Data collection and control for viewer metrics Detect QAMode (and new QAModeMetricsSubmode) settings which enable logging of metrics report locally and a faster cycle time to reduce test waiting. Do this only in the main thread and propagate the result via collector constructors (will likely move that out and put it in llappviewer/lltexturefetch which is more correct scope). Managed to deadlock myself with a recursive mutex (sheesh). --- indra/newview/llappviewer.cpp | 11 +++++++++-- indra/newview/lltexturefetch.cpp | 7 +++---- indra/newview/llviewerassetstats.cpp | 9 +++++---- indra/newview/llviewerassetstats.h | 14 ++++++++++---- indra/newview/tests/llviewerassetstats_test.cpp | 18 +++++++++--------- 5 files changed, 36 insertions(+), 23 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index e696e1af84..587d887146 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -666,11 +666,18 @@ bool LLAppViewer::init() { // Viewer metrics initialization - if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getBOOL("QAModeMetricsSubmode")) + static LLCachedControl metrics_submode(gSavedSettings, + "QAModeMetricsSubmode", + FALSE, + "Enables metrics submode when QAMode is also enabled"); + + bool qa_mode(false); + if (gSavedSettings.getBOOL("QAMode") && metrics_submode) { app_metrics_interval = METRICS_INTERVAL_QA; + qa_mode = true; } - LLViewerAssetStatsFF::init(); + LLViewerAssetStatsFF::init(qa_mode); } initThreads(); diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index e574a35479..8e43084adb 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -2680,8 +2680,9 @@ void LLTextureFetch::cmdEnqueue(TFRequest * req) { lockQueue(); mCommands.push_back(req); - wake(); unlockQueue(); + + wake(); } TFRequest * LLTextureFetch::cmdDequeue() @@ -2706,7 +2707,6 @@ void LLTextureFetch::cmdDoWork() return; // debug: don't do any work } - lockQueue(); TFRequest * req = cmdDequeue(); if (req) { @@ -2714,7 +2714,6 @@ void LLTextureFetch::cmdDoWork() req->doWork(this); delete req; } - unlockQueue(); } @@ -2834,7 +2833,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) } // In QA mode, Metrics submode, log the result for ease of testing - if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getBOOL("QAModeMetricsSubmode")) + if (gViewerAssetStatsThread1->isQAMode()) { LL_INFOS("QAViewerMetrics") << thread1_stats << LL_ENDL; } diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index c3e58cdd56..a63c1bf66d 100644 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -129,7 +129,8 @@ LLViewerAssetStats::PerRegionStats::accumulateTime(duration_t now) // ------------------------------------------------------ // LLViewerAssetStats class definition // ------------------------------------------------------ -LLViewerAssetStats::LLViewerAssetStats() +LLViewerAssetStats::LLViewerAssetStats(bool qa_mode) + : mQAMode(qa_mode) { reset(); } @@ -539,15 +540,15 @@ record_response_thread1(LLViewerAssetType::EType at, bool with_http, bool is_tem void -init() +init(bool qa_mode) { if (! gViewerAssetStatsMain) { - gViewerAssetStatsMain = new LLViewerAssetStats; + gViewerAssetStatsMain = new LLViewerAssetStats(qa_mode); } if (! gViewerAssetStatsThread1) { - gViewerAssetStatsThread1 = new LLViewerAssetStats; + gViewerAssetStatsThread1 = new LLViewerAssetStats(qa_mode); } } diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h index cb63b9c511..1668a1bc9d 100644 --- a/indra/newview/llviewerassetstats.h +++ b/indra/newview/llviewerassetstats.h @@ -140,7 +140,7 @@ public: }; public: - LLViewerAssetStats(); + LLViewerAssetStats(bool qa_mode); // Default destructor is correct. LLViewerAssetStats & operator=(const LLViewerAssetStats &); // Not defined @@ -196,6 +196,10 @@ public: // level. The "regions" information must be correctly formed or the // final result is undefined (little defensive action). static void mergeRegionsLLSD(const LLSD & src, LLSD & dst); + + // QA mode is established during initialization so we don't + // touch LLSD at runtime. + bool isQAMode() const { return mQAMode; } protected: typedef std::map > PerRegionContainer; @@ -215,6 +219,9 @@ protected: // Time of last reset duration_t mResetTimestamp; + + // QA Mode + const bool mQAMode; }; @@ -245,7 +252,7 @@ namespace LLViewerAssetStatsFF * you'll likely get away with calling it afterwards. cleanup() should only be * called after threads are shutdown to prevent races on the global pointers. */ -void init(); +void init(bool qa_mode); void cleanup(); @@ -298,5 +305,4 @@ void merge_stats(const LLSD & src, LLSD & dst); } // namespace LLViewerAssetStatsFF - -#endif // LL_LLVIEWERASSETSTATUS_H +#endif // LL_LLVIEWERASSETSTATUS_H diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index a44712e8ad..5a178fc585 100644 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -133,7 +133,7 @@ namespace tut { ensure("Global gViewerAssetStatsMain should be NULL", (NULL == gViewerAssetStatsMain)); - LLViewerAssetStats * it = new LLViewerAssetStats(); + LLViewerAssetStats * it = new LLViewerAssetStats(false); ensure("Global gViewerAssetStatsMain should still be NULL", (NULL == gViewerAssetStatsMain)); @@ -174,7 +174,7 @@ namespace tut template<> template<> void tst_viewerassetstats_index_object_t::test<3>() { - LLViewerAssetStats * it = new LLViewerAssetStats(); + LLViewerAssetStats * it = new LLViewerAssetStats(false); it->setRegionID(region1); LLSD sd = it->asLLSD(); @@ -193,7 +193,7 @@ namespace tut template<> template<> void tst_viewerassetstats_index_object_t::test<4>() { - gViewerAssetStatsMain = new LLViewerAssetStats(); + gViewerAssetStatsMain = new LLViewerAssetStats(false); LLViewerAssetStatsFF::set_region_main(region1); LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); @@ -230,8 +230,8 @@ namespace tut template<> template<> void tst_viewerassetstats_index_object_t::test<5>() { - gViewerAssetStatsThread1 = new LLViewerAssetStats(); - gViewerAssetStatsMain = new LLViewerAssetStats(); + gViewerAssetStatsThread1 = new LLViewerAssetStats(false); + gViewerAssetStatsMain = new LLViewerAssetStats(false); LLViewerAssetStatsFF::set_region_main(region1); LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); @@ -272,7 +272,7 @@ namespace tut template<> template<> void tst_viewerassetstats_index_object_t::test<6>() { - gViewerAssetStatsMain = new LLViewerAssetStats(); + gViewerAssetStatsMain = new LLViewerAssetStats(false); LLViewerAssetStatsFF::set_region_main(region1); @@ -329,7 +329,7 @@ namespace tut template<> template<> void tst_viewerassetstats_index_object_t::test<7>() { - gViewerAssetStatsMain = new LLViewerAssetStats(); + gViewerAssetStatsMain = new LLViewerAssetStats(false); LLViewerAssetStatsFF::set_region_main(region1); @@ -399,8 +399,8 @@ namespace tut template<> template<> void tst_viewerassetstats_index_object_t::test<8>() { - gViewerAssetStatsThread1 = new LLViewerAssetStats(); - gViewerAssetStatsMain = new LLViewerAssetStats(); + gViewerAssetStatsThread1 = new LLViewerAssetStats(false); + gViewerAssetStatsMain = new LLViewerAssetStats(false); LLViewerAssetStatsFF::set_region_main(region1); LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); -- cgit v1.2.3