summaryrefslogtreecommitdiff
path: root/indra/newview/tests
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2010-11-24 15:02:46 -0800
committerMonty Brandenberg <monty@lindenlab.com>2010-11-24 15:02:46 -0800
commita4bf7322895cac318abc3ac0a000086d227fc2fe (patch)
tree89ec7641aa02f54530e616d7a3001ca81a3aae2d /indra/newview/tests
parent0fd80d09972657e6417193abf577084a3b3b85f1 (diff)
ESC-154 ESC-155 Viewer metrics fixes for min/max merged values, floating timestamps.
The min/max response time calculations needed to be sensitive to the response counts to know if their was actual data. Failure to do so introduced a gratuitous min/max test against zero values which tended to corrupt the mins. Unit tests added to test for this condition. Finished conversion of times to floating point seconds. Removed two logging events used to debug the cross-thread messaging. Looks like a code completion point.
Diffstat (limited to 'indra/newview/tests')
-rw-r--r--indra/newview/tests/llviewerassetstats_test.cpp228
1 files changed, 228 insertions, 0 deletions
diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp
index a44712e8ad..8bedd2c860 100644
--- a/indra/newview/tests/llviewerassetstats_test.cpp
+++ b/indra/newview/tests/llviewerassetstats_test.cpp
@@ -518,4 +518,232 @@ namespace tut
ensure_approximately_equals("weighted mean of means", dst["regions"][reg1_name]["get_other"]["resp_mean"].asReal(), 2.7901295, 20);
}
}
+
+ // Maximum merges are interesting when one side contributes nothing
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<10>()
+ {
+ LLSD::String reg1_name = region1.asString();
+ LLSD::String reg2_name = region2.asString();
+
+ LLSD reg1_stats = LLSD::emptyMap();
+ LLSD reg2_stats = LLSD::emptyMap();
+
+ LLSD & tmp_other1 = reg1_stats["get_other"];
+ tmp_other1["enqueued"] = 4;
+ tmp_other1["dequeued"] = 4;
+ tmp_other1["resp_count"] = 7;
+ tmp_other1["resp_max"] = F64(-23.2892);
+ tmp_other1["resp_min"] = F64(-123.2892);
+ tmp_other1["resp_mean"] = F64(-58.28298);
+
+ LLSD & tmp_other2 = reg2_stats["get_other"];
+ tmp_other2["enqueued"] = 8;
+ tmp_other2["dequeued"] = 7;
+ tmp_other2["resp_count"] = 0;
+ tmp_other2["resp_max"] = F64(0);
+ tmp_other2["resp_min"] = F64(0);
+ tmp_other2["resp_mean"] = F64(0);
+
+ {
+ LLSD src = LLSD::emptyMap();
+ LLSD dst = LLSD::emptyMap();
+
+ src["regions"][reg1_name] = reg1_stats;
+ src["duration"] = 24;
+ dst["regions"][reg1_name] = reg2_stats;
+ dst["duration"] = 36;
+
+ LLViewerAssetStats::mergeRegionsLLSD(src, dst);
+
+ ensure_approximately_equals("dst maximum with count 0 does not contribute to merged maximum",
+ dst["regions"][reg1_name]["get_other"]["resp_max"].asReal(), F64(-23.2892), 20);
+ }
+
+ {
+ LLSD src = LLSD::emptyMap();
+ LLSD dst = LLSD::emptyMap();
+
+ src["regions"][reg1_name] = reg2_stats;
+ src["duration"] = 24;
+ dst["regions"][reg1_name] = reg1_stats;
+ dst["duration"] = 36;
+
+ LLViewerAssetStats::mergeRegionsLLSD(src, dst);
+
+ ensure_approximately_equals("src maximum with count 0 does not contribute to merged maximum",
+ dst["regions"][reg1_name]["get_other"]["resp_max"].asReal(), F64(-23.2892), 20);
+ }
+ }
+
+ // Minimum merges are interesting when one side contributes nothing
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<11>()
+ {
+ LLSD::String reg1_name = region1.asString();
+ LLSD::String reg2_name = region2.asString();
+
+ LLSD reg1_stats = LLSD::emptyMap();
+ LLSD reg2_stats = LLSD::emptyMap();
+
+ LLSD & tmp_other1 = reg1_stats["get_other"];
+ tmp_other1["enqueued"] = 4;
+ tmp_other1["dequeued"] = 4;
+ tmp_other1["resp_count"] = 7;
+ tmp_other1["resp_max"] = F64(123.2892);
+ tmp_other1["resp_min"] = F64(23.2892);
+ tmp_other1["resp_mean"] = F64(58.28298);
+
+ LLSD & tmp_other2 = reg2_stats["get_other"];
+ tmp_other2["enqueued"] = 8;
+ tmp_other2["dequeued"] = 7;
+ tmp_other2["resp_count"] = 0;
+ tmp_other2["resp_max"] = F64(0);
+ tmp_other2["resp_min"] = F64(0);
+ tmp_other2["resp_mean"] = F64(0);
+
+ {
+ LLSD src = LLSD::emptyMap();
+ LLSD dst = LLSD::emptyMap();
+
+ src["regions"][reg1_name] = reg1_stats;
+ src["duration"] = 24;
+ dst["regions"][reg1_name] = reg2_stats;
+ dst["duration"] = 36;
+
+ LLViewerAssetStats::mergeRegionsLLSD(src, dst);
+
+ ensure_approximately_equals("dst minimum with count 0 does not contribute to merged minimum",
+ dst["regions"][reg1_name]["get_other"]["resp_min"].asReal(), F64(23.2892), 20);
+ }
+
+ {
+ LLSD src = LLSD::emptyMap();
+ LLSD dst = LLSD::emptyMap();
+
+ src["regions"][reg1_name] = reg2_stats;
+ src["duration"] = 24;
+ dst["regions"][reg1_name] = reg1_stats;
+ dst["duration"] = 36;
+
+ LLViewerAssetStats::mergeRegionsLLSD(src, dst);
+
+ ensure_approximately_equals("src minimum with count 0 does not contribute to merged minimum",
+ dst["regions"][reg1_name]["get_other"]["resp_min"].asReal(), F64(23.2892), 20);
+ }
+ }
+
+ // resp_count missing is taken as '0' for maximum calculation
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<12>()
+ {
+ LLSD::String reg1_name = region1.asString();
+ LLSD::String reg2_name = region2.asString();
+
+ LLSD reg1_stats = LLSD::emptyMap();
+ LLSD reg2_stats = LLSD::emptyMap();
+
+ LLSD & tmp_other1 = reg1_stats["get_other"];
+ tmp_other1["enqueued"] = 4;
+ tmp_other1["dequeued"] = 4;
+ tmp_other1["resp_count"] = 7;
+ tmp_other1["resp_max"] = F64(-23.2892);
+ tmp_other1["resp_min"] = F64(-123.2892);
+ tmp_other1["resp_mean"] = F64(-58.28298);
+
+ LLSD & tmp_other2 = reg2_stats["get_other"];
+ tmp_other2["enqueued"] = 8;
+ tmp_other2["dequeued"] = 7;
+ // tmp_other2["resp_count"] = 0;
+ tmp_other2["resp_max"] = F64(0);
+ tmp_other2["resp_min"] = F64(0);
+ tmp_other2["resp_mean"] = F64(0);
+
+ {
+ LLSD src = LLSD::emptyMap();
+ LLSD dst = LLSD::emptyMap();
+
+ src["regions"][reg1_name] = reg1_stats;
+ src["duration"] = 24;
+ dst["regions"][reg1_name] = reg2_stats;
+ dst["duration"] = 36;
+
+ LLViewerAssetStats::mergeRegionsLLSD(src, dst);
+
+ ensure_approximately_equals("dst maximum with undefined count does not contribute to merged maximum",
+ dst["regions"][reg1_name]["get_other"]["resp_max"].asReal(), F64(-23.2892), 20);
+ }
+
+ {
+ LLSD src = LLSD::emptyMap();
+ LLSD dst = LLSD::emptyMap();
+
+ src["regions"][reg1_name] = reg2_stats;
+ src["duration"] = 24;
+ dst["regions"][reg1_name] = reg1_stats;
+ dst["duration"] = 36;
+
+ LLViewerAssetStats::mergeRegionsLLSD(src, dst);
+
+ ensure_approximately_equals("src maximum with undefined count does not contribute to merged maximum",
+ dst["regions"][reg1_name]["get_other"]["resp_max"].asReal(), F64(-23.2892), 20);
+ }
+ }
+
+ // resp_count unspecified is taken as 0 for minimum merges
+ template<> template<>
+ void tst_viewerassetstats_index_object_t::test<13>()
+ {
+ LLSD::String reg1_name = region1.asString();
+ LLSD::String reg2_name = region2.asString();
+
+ LLSD reg1_stats = LLSD::emptyMap();
+ LLSD reg2_stats = LLSD::emptyMap();
+
+ LLSD & tmp_other1 = reg1_stats["get_other"];
+ tmp_other1["enqueued"] = 4;
+ tmp_other1["dequeued"] = 4;
+ tmp_other1["resp_count"] = 7;
+ tmp_other1["resp_max"] = F64(123.2892);
+ tmp_other1["resp_min"] = F64(23.2892);
+ tmp_other1["resp_mean"] = F64(58.28298);
+
+ LLSD & tmp_other2 = reg2_stats["get_other"];
+ tmp_other2["enqueued"] = 8;
+ tmp_other2["dequeued"] = 7;
+ // tmp_other2["resp_count"] = 0;
+ tmp_other2["resp_max"] = F64(0);
+ tmp_other2["resp_min"] = F64(0);
+ tmp_other2["resp_mean"] = F64(0);
+
+ {
+ LLSD src = LLSD::emptyMap();
+ LLSD dst = LLSD::emptyMap();
+
+ src["regions"][reg1_name] = reg1_stats;
+ src["duration"] = 24;
+ dst["regions"][reg1_name] = reg2_stats;
+ dst["duration"] = 36;
+
+ LLViewerAssetStats::mergeRegionsLLSD(src, dst);
+
+ ensure_approximately_equals("dst minimum with undefined count does not contribute to merged minimum",
+ dst["regions"][reg1_name]["get_other"]["resp_min"].asReal(), F64(23.2892), 20);
+ }
+
+ {
+ LLSD src = LLSD::emptyMap();
+ LLSD dst = LLSD::emptyMap();
+
+ src["regions"][reg1_name] = reg2_stats;
+ src["duration"] = 24;
+ dst["regions"][reg1_name] = reg1_stats;
+ dst["duration"] = 36;
+
+ LLViewerAssetStats::mergeRegionsLLSD(src, dst);
+
+ ensure_approximately_equals("src minimum with undefined count does not contribute to merged minimum",
+ dst["regions"][reg1_name]["get_other"]["resp_min"].asReal(), F64(23.2892), 20);
+ }
+ }
}