diff options
author | RunitaiLinden <davep@lindenlab.com> | 2023-05-12 18:09:35 -0500 |
---|---|---|
committer | RunitaiLinden <davep@lindenlab.com> | 2023-05-12 18:09:35 -0500 |
commit | e3f9244375e3ddfb96a38afac007f0a5a68d3b46 (patch) | |
tree | a19222a88574bb8e87945ddd8e502fbaadc158f2 /indra/newview | |
parent | 06bdee663433bf5b12eddcbcfcb8785546354c28 (diff) |
SL-19710 Fix for deadlock in LLPerfStats. Move General thread initialization to earlier in session (unrelated).
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llperfstats.cpp | 22 | ||||
-rw-r--r-- | indra/newview/llperfstats.h | 32 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 3 |
5 files changed, 28 insertions, 38 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index c9fc0e2cc8..ecb5b81abd 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2214,6 +2214,10 @@ bool LLAppViewer::initThreads() LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), enable_threads && true, app_metrics_qa_mode); + + // general task background thread (LLPerfStats, etc) + LLAppViewer::instance()->initGeneralThread(); + LLAppViewer::sPurgeDiskCacheThread = new LLPurgeDiskCacheThread(); if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog) @@ -5632,6 +5636,8 @@ void LLAppViewer::pauseMainloopTimeout() void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_APP; + if(mMainloopTimeout) { if(secs < 0.0f) diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 395ac0e788..64e66d520b 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -146,7 +146,7 @@ namespace LLPerfStats resetChanges(); } - StatsRecorder::StatsRecorder():q(1024*16) + StatsRecorder::StatsRecorder() { // create a queue tunables.initialiseFromSettings(); @@ -292,26 +292,6 @@ namespace LLPerfStats sTotalAvatarTime = LLVOAvatar::getTotalGPURenderTime(); sAverageAvatarTime = LLVOAvatar::getAverageGPURenderTime(); sMaxAvatarTime = LLVOAvatar::getMaxGPURenderTime(); - - auto general = LL::WorkQueue::getInstance("General"); - - if (general) - { - general->post([] { StatsRecorder::update(); }); - } - } - - // called once per main loop iteration on General thread - void StatsRecorder::update() - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - StatsRecord upd; - auto& instance{ StatsRecorder::getInstance() }; - - while (enabled() && !LLApp::isQuitting() && instance.q.tryPop(upd)) - { - instance.processUpdate(upd); - } } //static diff --git a/indra/newview/llperfstats.h b/indra/newview/llperfstats.h index bb5677f237..33777abdbf 100644 --- a/indra/newview/llperfstats.h +++ b/indra/newview/llperfstats.h @@ -162,12 +162,7 @@ namespace LLPerfStats extern Tunables tunables; class StatsRecorder{ - using Queue = LLThreadSafeQueue<StatsRecord>; public: - - // called once per main loop iteration on General thread - static void update(); - static inline StatsRecorder& getInstance() { static StatsRecorder instance; @@ -176,9 +171,24 @@ namespace LLPerfStats static inline void setFocusAv(const LLUUID& avID){focusAv = avID;}; static inline const LLUUID& getFocusAv(){return focusAv;}; static inline void setAutotuneInit(){autotuneInit = true;}; - static inline void send(StatsRecord && upd){StatsRecorder::getInstance().q.pushFront(std::move(upd));}; - static void endFrame(){StatsRecorder::getInstance().q.pushFront(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 0});}; - static void clearStats(){StatsRecorder::getInstance().q.pushFront(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 1});}; + + static inline void send(StatsRecord && upd) + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + StatsRecorder::getInstance().processUpdate(upd); + } + + static void endFrame() + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + StatsRecorder::getInstance().processUpdate(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 0}); + } + + static void clearStats() + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + StatsRecorder::getInstance().processUpdate(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 1}); + } static inline void setEnabled(bool on_or_off){collectionEnabled=on_or_off;}; static inline void enable() { collectionEnabled=true; }; @@ -284,8 +294,6 @@ namespace LLPerfStats static void toggleBuffer(); static void clearStatsBuffers(); - Queue q; - ~StatsRecorder() = default; StatsRecorder(const StatsRecorder&) = delete; StatsRecorder& operator=(const StatsRecorder&) = delete; @@ -307,7 +315,7 @@ namespace LLPerfStats start{LLTrace::BlockTimer::getCPUClockCount64()}, stat{type, ObjTypeDiscriminator, std::move(av), std::move(id), 0, isRiggedAtt, isHUDAtt} { - //LL_PROFILE_ZONE_COLOR(tracy::Color::Orange); + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; }; template < ObjType_t OD = ObjTypeDiscriminator, @@ -324,8 +332,6 @@ namespace LLPerfStats return; } - //LL_PROFILE_ZONE_COLOR(tracy::Color::Red); - stat.time = LLTrace::BlockTimer::getCPUClockCount64() - start; StatsRecorder::send(std::move(stat)); }; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 65fdd400bf..3ddc33f783 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1553,9 +1553,6 @@ bool idle_startup() gAgentCamera.resetCamera(); display_startup(); - // start up the ThreadPool we'll use for textures et al. - LLAppViewer::instance()->initGeneralThread(); - // Initialize global class data needed for surfaces (i.e. textures) LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL; // Initialize all of the viewer object classes for the first time (doing things like texture fetches. diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index a2938eaefe..6065fa1b34 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -244,9 +244,10 @@ void display_stats() // Paint the display! void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { - LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_DISPLAY); // render time capture - This is the main stat for overall rendering. LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Render"); + LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_DISPLAY); // render time capture - This is the main stat for overall rendering. + if (gWindowResized) { //skip render on frames where window has been resized LL_DEBUGS("Window") << "Resizing window" << LL_ENDL; |