summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerstats.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerstats.cpp')
-rw-r--r--indra/newview/llviewerstats.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 73aabf49d1..a4b06b1e1a 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -66,6 +66,8 @@
#include "llinventorymodel.h"
#include "lluiusage.h"
#include "lltranslate.h"
+#include "llluamanager.h"
+#include "scope_exit.h"
// "Minimal Vulkan" to get max API Version
@@ -509,7 +511,6 @@ void send_viewer_stats(bool include_preferences)
return;
}
- LLSD body;
std::string url = gAgent.getRegion()->getCapability("ViewerStats");
if (url.empty()) {
@@ -517,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;
@@ -620,6 +631,10 @@ void send_viewer_stats(bool include_preferences)
system["shader_level"] = shader_level;
+ LLSD &scripts = body["scripts"];
+ scripts["lua_scripts"] = LLLUAmanager::sScriptCount;
+ scripts["lua_auto_scripts"] = LLLUAmanager::sAutorunScriptCount;
+
LLSD &download = body["downloads"];
download["world_kbytes"] = F64Kilobytes(gTotalWorldData).value();
@@ -774,7 +789,9 @@ void send_viewer_stats(bool include_preferences)
LL_INFOS("LogViewerStatsPacket") << "Sending viewer statistics: " << body << LL_ENDL;
- LL_DEBUGS("LogViewerStatsPacket");
+
+ // <ND> Do those lines even do anything sane in regard of debug logging?
+ LL_DEBUGS("LogViewerStatsPacket") << " ";
std::string filename("viewer_stats_packet.xml");
llofstream of(filename.c_str());
LLSDSerialize::toPrettyXML(body,of);
@@ -784,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)