summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/lltexturefetch.cpp2
-rw-r--r--indra/newview/llviewerassetstats.cpp42
-rw-r--r--indra/newview/llviewerassetstats.h10
-rw-r--r--indra/newview/tests/llviewerassetstats_test.cpp56
5 files changed, 64 insertions, 48 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 3640d01642..32bd51d3e2 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3808,7 +3808,7 @@ void LLAppViewer::idle()
// 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);
+ LLViewerAssetStatsFF::record_fps_main(gFPSClamped);
}
}
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index e1f9d7bdcc..88905372f6 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -2915,7 +2915,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
// Merge existing stats into those from main, convert to LLSD
main_stats.merge(*gViewerAssetStatsThread1);
- LLSD merged_llsd = main_stats.asLLSD();
+ LLSD merged_llsd = main_stats.asLLSD(true);
// Add some additional meta fields to the content
merged_llsd["session_id"] = mSessionID;
diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp
index 399d62d2fc..5ad7725b3e 100644
--- a/indra/newview/llviewerassetstats.cpp
+++ b/indra/newview/llviewerassetstats.cpp
@@ -33,6 +33,7 @@
#include "llviewerprecompiledheaders.h"
#include "llviewerassetstats.h"
+#include "llregionhandle.h"
#include "stdtypes.h"
@@ -258,7 +259,7 @@ LLViewerAssetStats::recordFPS(F32 fps)
}
LLSD
-LLViewerAssetStats::asLLSD()
+LLViewerAssetStats::asLLSD(bool compact_output)
{
// Top-level tags
static const LLSD::String tags[EVACCount] =
@@ -290,7 +291,7 @@ LLViewerAssetStats::asLLSD()
const duration_t now = LLViewerAssetStatsFF::get_timestamp();
mCurRegionStats->accumulateTime(now);
- LLSD regions = LLSD::emptyMap();
+ LLSD regions = LLSD::emptyArray();
for (PerRegionContainer::iterator it = mRegionStats.begin();
mRegionStats.end() != it;
++it)
@@ -307,16 +308,25 @@ LLViewerAssetStats::asLLSD()
for (int i = 0; i < LL_ARRAY_SIZE(tags); ++i)
{
- LLSD & slot = reg_stat[tags[i]];
- slot = LLSD::emptyMap();
- slot[enq_tag] = LLSD(S32(stats.mRequests[i].mEnqueued.getCount()));
- slot[deq_tag] = LLSD(S32(stats.mRequests[i].mDequeued.getCount()));
- slot[rcnt_tag] = LLSD(S32(stats.mRequests[i].mResponse.getCount()));
- slot[rmin_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMin() * 1.0e-6));
- slot[rmax_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMax() * 1.0e-6));
- slot[rmean_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMean() * 1.0e-6));
+ PerRegionStats::prs_group & group(stats.mRequests[i]);
+
+ if ((! compact_output) ||
+ group.mEnqueued.getCount() ||
+ group.mDequeued.getCount() ||
+ group.mResponse.getCount())
+ {
+ LLSD & slot = reg_stat[tags[i]];
+ slot = LLSD::emptyMap();
+ slot[enq_tag] = LLSD(S32(stats.mRequests[i].mEnqueued.getCount()));
+ slot[deq_tag] = LLSD(S32(stats.mRequests[i].mDequeued.getCount()));
+ slot[rcnt_tag] = LLSD(S32(stats.mRequests[i].mResponse.getCount()));
+ slot[rmin_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMin() * 1.0e-6));
+ slot[rmax_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMax() * 1.0e-6));
+ slot[rmean_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMean() * 1.0e-6));
+ }
}
+ if ((! compact_output) || stats.mFPS.getCount())
{
LLSD & slot = reg_stat["fps"];
slot = LLSD::emptyMap();
@@ -326,12 +336,12 @@ LLViewerAssetStats::asLLSD()
slot[mean_tag] = LLSD(F64(stats.mFPS.getMean()));
}
- reg_stat["duration"] = LLSD::Real(stats.mTotalTime * 1.0e-6);
- std::stringstream reg_handle;
- reg_handle.width(16);
- reg_handle.fill('0');
- reg_handle << std::hex << it->first;
- regions[reg_handle.str()] = reg_stat;
+ U32 grid_x(0), grid_y(0);
+ grid_from_region_handle(it->first, &grid_x, &grid_y);
+ reg_stat["grid_x"] = LLSD::Integer(grid_x);
+ reg_stat["grid_y"] = LLSD::Integer(grid_y);
+ reg_stat["duration"] = LLSD::Real(stats.mTotalTime * 1.0e-6);
+ regions.append(reg_stat);
}
LLSD ret = LLSD::emptyMap();
diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h
index af6bf5b695..905ceefad5 100644
--- a/indra/newview/llviewerassetstats.h
+++ b/indra/newview/llviewerassetstats.h
@@ -155,7 +155,7 @@ public:
duration_t mStartTimestamp;
LLSimpleStatMMM<> mFPS;
- struct
+ struct prs_group
{
LLSimpleStatCounter mEnqueued;
LLSimpleStatCounter mDequeued;
@@ -232,7 +232,13 @@ public:
// }
// }
// }
- LLSD asLLSD();
+ //
+ // @param compact_output If true, omits from conversion any mmm_block
+ // or stats_block that would contain all zero data.
+ // Useful for transmission when the receiver knows
+ // what is expected and will assume zero for missing
+ // blocks.
+ LLSD asLLSD(bool compact_output);
protected:
typedef std::map<region_handle_t, LLPointer<PerRegionStats> > PerRegionContainer;
diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp
index 9c54266017..40a7103dba 100644
--- a/indra/newview/tests/llviewerassetstats_test.cpp
+++ b/indra/newview/tests/llviewerassetstats_test.cpp
@@ -155,7 +155,7 @@ namespace tut
ensure("Global gViewerAssetStatsMain should still be NULL", (NULL == gViewerAssetStatsMain));
- LLSD sd_full = it->asLLSD();
+ LLSD sd_full = it->asLLSD(false);
// Default (NULL) region ID doesn't produce LLSD results so should
// get an empty map back from output
@@ -163,7 +163,7 @@ namespace tut
// Once the region is set, we will get a response even with no data collection
it->setRegion(region1_handle);
- sd_full = it->asLLSD();
+ sd_full = it->asLLSD(false);
ensure("Correct single-key LLSD map root", is_double_key_map(sd_full, "duration", "regions"));
ensure("Correct single-key LLSD map regions", is_single_key_map(sd_full["regions"], region1_handle_str));
@@ -204,7 +204,7 @@ namespace tut
LLViewerAssetStats * it = new LLViewerAssetStats();
it->setRegion(region1_handle);
- LLSD sd = it->asLLSD();
+ LLSD sd = it->asLLSD(false);
ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
ensure("Correct single-key LLSD map regions", is_single_key_map(sd["regions"], region1_handle_str));
sd = sd[region1_handle_str];
@@ -229,7 +229,7 @@ namespace tut
LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false);
LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false);
- LLSD sd = gViewerAssetStatsMain->asLLSD();
+ LLSD sd = gViewerAssetStatsMain->asLLSD(false);
ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
ensure("Correct single-key LLSD map regions", is_single_key_map(sd["regions"], region1_handle_str));
sd = sd["regions"][region1_handle_str];
@@ -244,7 +244,7 @@ namespace tut
// Reset and check zeros...
// Reset leaves current region in place
gViewerAssetStatsMain->reset();
- sd = gViewerAssetStatsMain->asLLSD()["regions"][region1_handle_str];
+ sd = gViewerAssetStatsMain->asLLSD(false)["regions"][region1_handle_str];
delete gViewerAssetStatsMain;
gViewerAssetStatsMain = NULL;
@@ -267,9 +267,9 @@ namespace tut
LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false);
LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false);
- LLSD sd = gViewerAssetStatsThread1->asLLSD();
+ LLSD sd = gViewerAssetStatsThread1->asLLSD(false);
ensure("Other collector is empty", is_no_stats_map(sd));
- sd = gViewerAssetStatsMain->asLLSD();
+ sd = gViewerAssetStatsMain->asLLSD(false);
ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
ensure("Correct single-key LLSD map regions", is_single_key_map(sd["regions"], region1_handle_str));
sd = sd["regions"][region1_handle_str];
@@ -284,7 +284,7 @@ namespace tut
// Reset and check zeros...
// Reset leaves current region in place
gViewerAssetStatsMain->reset();
- sd = gViewerAssetStatsMain->asLLSD()["regions"][region1_handle_str];
+ sd = gViewerAssetStatsMain->asLLSD(false)["regions"][region1_handle_str];
delete gViewerAssetStatsMain;
gViewerAssetStatsMain = NULL;
@@ -316,7 +316,7 @@ namespace tut
LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false);
LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false);
- LLSD sd = gViewerAssetStatsMain->asLLSD();
+ LLSD sd = gViewerAssetStatsMain->asLLSD(false);
// std::cout << sd << std::endl;
@@ -340,7 +340,7 @@ namespace tut
// Reset and check zeros...
// Reset leaves current region in place
gViewerAssetStatsMain->reset();
- sd = gViewerAssetStatsMain->asLLSD();
+ sd = gViewerAssetStatsMain->asLLSD(false);
ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
ensure("Correct single-key LLSD map regions", is_single_key_map(sd["regions"], region2_handle_str));
sd2 = sd["regions"][region2_handle_str];
@@ -388,7 +388,7 @@ namespace tut
LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false);
LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false);
- LLSD sd = gViewerAssetStatsMain->asLLSD();
+ LLSD sd = gViewerAssetStatsMain->asLLSD(false);
ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions"));
ensure("Correct double-key LLSD map regions", is_double_key_map(sd["regions"], region1_handle_str, region2_handle_str));
@@ -410,7 +410,7 @@ namespace tut
// Reset and check zeros...
// Reset leaves current region in place
gViewerAssetStatsMain->reset();
- sd = gViewerAssetStatsMain->asLLSD();
+ sd = gViewerAssetStatsMain->asLLSD(false);
ensure("Correct single-key LLSD map root", is_double_key_map(sd, "duration", "regions"));
ensure("Correct single-key LLSD map regions", is_single_key_map(sd["regions"], region2_handle_str));
sd2 = sd["regions"][region2_handle_str];
@@ -453,9 +453,9 @@ namespace tut
LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_LSL_BYTECODE, true, true);
- LLSD sd = gViewerAssetStatsThread1->asLLSD();
+ LLSD sd = gViewerAssetStatsThread1->asLLSD(false);
ensure("Other collector is empty", is_no_stats_map(sd));
- sd = gViewerAssetStatsMain->asLLSD();
+ sd = gViewerAssetStatsMain->asLLSD(false);
ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration"));
ensure("Correct single-key LLSD map regions", is_single_key_map(sd["regions"], region1_handle_str));
sd = sd["regions"][region1_handle_str];
@@ -473,7 +473,7 @@ namespace tut
// Reset and check zeros...
// Reset leaves current region in place
gViewerAssetStatsMain->reset();
- sd = gViewerAssetStatsMain->asLLSD()["regions"][region1_handle_str];
+ sd = gViewerAssetStatsMain->asLLSD(false)["regions"][region1_handle_str];
delete gViewerAssetStatsMain;
gViewerAssetStatsMain = NULL;
@@ -507,7 +507,7 @@ namespace tut
s2.merge(s1);
- LLSD s2_llsd = s2.asLLSD();
+ LLSD s2_llsd = s2.asLLSD(false);
ensure_equals("count after merge", 8, s2_llsd["regions"][region1_handle_str]["get_texture_temp_http"]["resp_count"].asInteger());
ensure_approximately_equals("min after merge", 2.0, s2_llsd["regions"][region1_handle_str]["get_texture_temp_http"]["resp_min"].asReal(), 22);
@@ -562,8 +562,8 @@ namespace tut
{
s2.merge(s1);
- LLSD src = s1.asLLSD();
- LLSD dst = s2.asLLSD();
+ LLSD src = s1.asLLSD(false);
+ LLSD dst = s2.asLLSD(false);
// Remove time stamps, they're a problem
src.erase("duration");
@@ -621,8 +621,8 @@ namespace tut
{
s2.merge(s1);
- LLSD src = s1.asLLSD();
- LLSD dst = s2.asLLSD();
+ LLSD src = s1.asLLSD(false);
+ LLSD dst = s2.asLLSD(false);
// Remove time stamps, they're a problem
src.erase("duration");
@@ -689,8 +689,8 @@ namespace tut
{
s2.merge(s1);
- LLSD src = s1.asLLSD();
- LLSD dst = s2.asLLSD();
+ LLSD src = s1.asLLSD(false);
+ LLSD dst = s2.asLLSD(false);
// Remove time stamps, they're a problem
src.erase("duration");
@@ -745,8 +745,8 @@ namespace tut
{
s1.merge(s2);
- LLSD src = s2.asLLSD();
- LLSD dst = s1.asLLSD();
+ LLSD src = s2.asLLSD(false);
+ LLSD dst = s1.asLLSD(false);
// Remove time stamps, they're a problem
src.erase("duration");
@@ -804,8 +804,8 @@ namespace tut
{
s2.merge(s1);
- LLSD src = s1.asLLSD();
- LLSD dst = s2.asLLSD();
+ LLSD src = s1.asLLSD(false);
+ LLSD dst = s2.asLLSD(false);
// Remove time stamps, they're a problem
src.erase("duration");
@@ -859,8 +859,8 @@ namespace tut
{
s1.merge(s2);
- LLSD src = s2.asLLSD();
- LLSD dst = s1.asLLSD();
+ LLSD src = s2.asLLSD(false);
+ LLSD dst = s1.asLLSD(false);
// Remove time stamps, they're a problem
src.erase("duration");