SL-19710 Fix for deadlock in LLPerfStats. Move General thread initialization to earlier in session (unrelated).
parent
06bdee6634
commit
e3f9244375
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue