summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2010-12-10 17:41:05 -0800
committerMonty Brandenberg <monty@lindenlab.com>2010-12-10 17:41:05 -0800
commit11d420dd32e643a191c16b04f2fbb42c2b4db628 (patch)
treeaa9aa0be3b72c178e8fd41ea59e55d50d91590bb /indra/newview/llappviewer.cpp
parent4bab98f5cd2a815d10fe494a0a7e51cc237adb4a (diff)
Decided to refactor a bit. Was using LLSD as an internal data
representation transferring ownership, doing data aggregation in a very pedantic way. That's just adding unneeded cost and complication. Used the same objects to transport data as are collecting it and everything got simpler, faster, easier to read with fewer gotchas. Bit myself *again* doing the min/max/mean merges but the unittests where there to pick me up again. Added a per-region FPS metric while I was at it. This is much asked for and there was a convenient place to sample the value.
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index c667fba86f..3640d01642 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3804,6 +3804,11 @@ void LLAppViewer::idle()
llinfos << "Unknown object updates: " << gObjectList.mNumUnknownUpdates << llendl;
gObjectList.mNumUnknownUpdates = 0;
}
+
+ // ViewerMetrics FPS piggy-backing on the debug timer.
+ // The 5-second interval is nice for this purpose. If the object debug
+ // bit moves or is disabled, please give this a suitable home.
+ LLViewerAssetStatsFF::record_fps_main(frame_rate_clamped);
}
}
@@ -4805,23 +4810,17 @@ void LLAppViewer::metricsSend(bool enable_reporting)
{
std::string caps_url = regionp->getCapability("ViewerMetrics");
- // *NOTE: Pay attention here. LLSD's are not safe for thread sharing
- // and their ownership is difficult to transfer across threads. We do
- // it here by having only one reference (the new'd pointer) to the LLSD
- // or any subtree of it. This pointer is then transfered to the other
- // thread using correct thread logic to do all data ordering.
- LLSD * envelope = new LLSD(LLSD::emptyMap());
- {
- (*envelope) = gViewerAssetStatsMain->asLLSD();
- (*envelope)["session_id"] = gAgentSessionID;
- (*envelope)["agent_id"] = gAgentID;
- }
-
+ // Make a copy of the main stats to send into another thread.
+ // Receiving thread takes ownership.
+ LLViewerAssetStats * main_stats(new LLViewerAssetStats(*gViewerAssetStatsMain));
+
// Send a report request into 'thread1' to get the rest of the data
- // and have it sent to the stats collector. LLSD ownership transfers
- // with this call.
- LLAppViewer::sTextureFetch->commandSendMetrics(caps_url, envelope);
- envelope = 0; // transfer noted
+ // and provide some additional parameters while here.
+ LLAppViewer::sTextureFetch->commandSendMetrics(caps_url,
+ gAgentSessionID,
+ gAgentID,
+ main_stats);
+ main_stats = 0; // Ownership transferred
}
else
{