summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-10-17 15:26:04 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-10-17 15:26:04 -0400
commitc4f2ad1bc2ba08437de19fd6129035b6cbc6e0e1 (patch)
treefa3ccbd12fd90c6ee67a5cf6aa217f451e7fed73 /indra
parent9927ac2561eaa4aed94bd82a90d006f614c6cf05 (diff)
Add the latest viewer stats packet into Frame Profile dump file.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llviewerdisplay.cpp4
-rw-r--r--indra/newview/llviewerstats.cpp15
-rw-r--r--indra/newview/llviewerstats.h1
3 files changed, 19 insertions, 1 deletions
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 1f4502323c..e8c9b569ee 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -79,6 +79,7 @@
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llviewershadermgr.h"
+#include "llviewerstats.h"
#include "llviewertexturelist.h"
#include "llviewerwindow.h"
#include "llvoavatarself.h"
@@ -1085,6 +1086,9 @@ void getProfileStatsContext(boost::json::object& stats)
context.emplace("parcelid", parcel->getLocalID());
}
context.emplace("time", LLDate::now().toHTTPDateString("%Y-%m-%dT%H:%M:%S"));
+
+ // supplement with stats packet
+ stats.emplace("stats", LlsdToJson(get_viewer_stats()));
}
std::string getProfileStatsFilename()
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 9d4c072909..2392973449 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -314,6 +314,11 @@ 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;
@@ -488,6 +493,11 @@ void update_statistics()
}
}
+LLSD get_viewer_stats()
+{
+ return latest_stats_packet;
+}
+
/*
* The sim-side LLSD is in newsim/llagentinfo.cpp:forwardViewerStats.
*
@@ -510,7 +520,10 @@ void send_viewer_stats(bool include_preferences)
return;
}
- LLSD body;
+ // 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()) {
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index 8aed1c537e..f558a5d909 100644
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -281,6 +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();
void send_viewer_stats(bool include_preferences);
void update_texture_time();