diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-10-21 10:31:57 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-10-21 10:31:57 -0400 |
commit | 5a24ddd305aeb561ccfadb37a96a26cca1131ae7 (patch) | |
tree | 03c3f9dd660b5028dde4625dc8508d4b536c51ca | |
parent | 2a6234e59dc2cebc5e15b7f3685dbf233aa080fb (diff) |
Regenerate viewer stats for frame profile dump file
instead of reporting the most recent previous viewer stats blob.
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerstats.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llviewerstats.h | 2 |
3 files changed, 15 insertions, 21 deletions
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index e8c9b569ee..cb741e4af9 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1088,7 +1088,7 @@ void getProfileStatsContext(boost::json::object& stats) context.emplace("time", LLDate::now().toHTTPDateString("%Y-%m-%dT%H:%M:%S")); // supplement with stats packet - stats.emplace("stats", LlsdToJson(get_viewer_stats())); + stats.emplace("stats", LlsdToJson(capture_viewer_stats(true))); } std::string getProfileStatsFilename() diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 2392973449..a4b06b1e1a 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -67,6 +67,7 @@ #include "lluiusage.h" #include "lltranslate.h" #include "llluamanager.h" +#include "scope_exit.h" // "Minimal Vulkan" to get max API Version @@ -314,11 +315,6 @@ F32Milliseconds gAvgSimPing(0.f); // rely on default initialization U32Bytes gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY]; -// send_viewer_stats() does enough work that we cache the most recently -// created stats packet for interested observers, instead of rebuilding it on -// demand. -LLSD latest_stats_packet; - extern U32 gVisCompared; extern U32 gVisTested; @@ -493,11 +489,6 @@ void update_statistics() } } -LLSD get_viewer_stats() -{ - return latest_stats_packet; -} - /* * The sim-side LLSD is in newsim/llagentinfo.cpp:forwardViewerStats. * @@ -520,10 +511,6 @@ void send_viewer_stats(bool include_preferences) return; } - // Instead of building the stats packet locally within this function, - // build it in the cached value. Clear it first, though. - LLSD& body = latest_stats_packet; - body.clear(); std::string url = gAgent.getRegion()->getCapability("ViewerStats"); if (url.empty()) { @@ -531,8 +518,18 @@ void send_viewer_stats(bool include_preferences) return; } - LLViewerStats::instance().getRecording().pause(); + LLSD body = capture_viewer_stats(include_preferences); + LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, body, + "Statistics posted to sim", "Failed to post statistics to sim"); +} + +LLSD capture_viewer_stats(bool include_preferences) +{ + LLViewerStats& vstats{ LLViewerStats::instance() }; + vstats.getRecording().pause(); + LL::scope_exit cleanup([&vstats]{ vstats.getRecording().resume(); }); + LLSD body; LLSD &agent = body["agent"]; time_t ltime; @@ -804,10 +801,7 @@ void send_viewer_stats(bool include_preferences) body["session_id"] = gAgentSessionID; LLViewerStats::getInstance()->addToMessage(body); - - LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, body, - "Statistics posted to sim", "Failed to post statistics to sim"); - LLViewerStats::instance().getRecording().resume(); + return body; } LLTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index f558a5d909..dd66fee436 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -281,7 +281,7 @@ static const F32 SEND_STATS_PERIOD = 300.0f; // The following are from (older?) statistics code found in appviewer. void update_statistics(); -LLSD get_viewer_stats(); +LLSD capture_viewer_stats(bool include_preferences); void send_viewer_stats(bool include_preferences); void update_texture_time(); |