diff options
Diffstat (limited to 'indra/newview/tests/llviewerassetstats_test.cpp')
-rwxr-xr-x | indra/newview/tests/llviewerassetstats_test.cpp | 686 |
1 files changed, 126 insertions, 560 deletions
diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index a331d9aa9e..a08e32cb49 100755 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -35,8 +35,38 @@ #include "lluuid.h" #include "llsdutil.h" #include "llregionhandle.h" +#include "lltracethreadrecorder.h" #include "../llvoavatar.h" +namespace LLStatViewer +{ + LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"); +} + +void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) +{ + counts.resize(3); + counts[0] = 0; + counts[1] = 0; + counts[2] = 1; +} + +// static +std::string LLVOAvatar::rezStatusToString(S32 rez_status) +{ + if (rez_status==0) return "cloud"; + if (rez_status==1) return "gray"; + if (rez_status==2) return "textured"; + return "unknown"; +} + +// static +LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) +{ + static LLViewerStats::StatsAccumulator junk; + return junk; +} + static const char * all_keys[] = { "duration", @@ -199,7 +229,19 @@ get_region(const LLSD & sd, U64 region_handle1) namespace tut { struct tst_viewerassetstats_index - {}; + { + tst_viewerassetstats_index() + { + LLTrace::set_master_thread_recorder(&mThreadRecorder); + } + + ~tst_viewerassetstats_index() + { + LLTrace::set_master_thread_recorder(NULL); + } + + LLTrace::ThreadRecorder mThreadRecorder; + }; typedef test_group<tst_viewerassetstats_index> tst_viewerassetstats_index_t; typedef tst_viewerassetstats_index_t::object tst_viewerassetstats_index_object_t; tut::tst_viewerassetstats_index_t tut_tst_viewerassetstats_index("tst_viewerassetstats_test"); @@ -209,24 +251,24 @@ namespace tut void tst_viewerassetstats_index_object_t::test<1>() { // Check that helpers aren't bothered by missing global stats - ensure("Global gViewerAssetStatsMain should be NULL", (NULL == gViewerAssetStatsMain)); + ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats)); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_response_main(LLViewerAssetType::AT_GESTURE, false, false, 12300000ULL); + LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_GESTURE, false, false, (U64Microseconds)12300000ULL); } // Create a non-global instance and check the structure template<> template<> void tst_viewerassetstats_index_object_t::test<2>() { - ensure("Global gViewerAssetStatsMain should be NULL", (NULL == gViewerAssetStatsMain)); + ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats)); LLViewerAssetStats * it = new LLViewerAssetStats(); - ensure("Global gViewerAssetStatsMain should still be NULL", (NULL == gViewerAssetStatsMain)); + ensure("Global gViewerAssetStats should still be NULL", (NULL == gViewerAssetStats)); LLSD sd_full = it->asLLSD(false); @@ -293,16 +335,16 @@ namespace tut template<> template<> void tst_viewerassetstats_index_object_t::test<4>() { - gViewerAssetStatsMain = new LLViewerAssetStats(); - LLViewerAssetStatsFF::set_region_main(region1_handle); + gViewerAssetStats = new LLViewerAssetStats(); + LLViewerAssetStatsFF::set_region(region1_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - LLSD sd = gViewerAssetStatsMain->asLLSD(false); + LLSD sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd["regions"][0]; @@ -316,80 +358,38 @@ namespace tut // Reset and check zeros... // Reset leaves current region in place - gViewerAssetStatsMain->reset(); - sd = gViewerAssetStatsMain->asLLSD(false)["regions"][region1_handle_str]; + gViewerAssetStats->reset(); + sd = gViewerAssetStats->asLLSD(false)["regions"][region1_handle_str]; - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = NULL; + delete gViewerAssetStats; + gViewerAssetStats = NULL; ensure("sd[get_texture_non_temp_udp][enqueued] is reset", (0 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger())); ensure("sd[get_gesture_udp][dequeued] is reset", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); } - // Create two global instances and verify no interactions + // Check multiple region collection template<> template<> void tst_viewerassetstats_index_object_t::test<5>() { - gViewerAssetStatsThread1 = new LLViewerAssetStats(); - gViewerAssetStatsMain = new LLViewerAssetStats(); - LLViewerAssetStatsFF::set_region_main(region1_handle); + gViewerAssetStats = new LLViewerAssetStats(); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::set_region(region1_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - LLSD sd = gViewerAssetStatsThread1->asLLSD(false); - ensure("Other collector is empty", is_no_stats_map(sd)); - sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); - ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); - sd = sd["regions"][0]; + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - // Check a few points on the tree for content - ensure("sd[get_texture_non_temp_udp][enqueued] is 1", (1 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger())); - ensure("sd[get_texture_temp_udp][enqueued] is 0", (0 == sd["get_texture_temp_udp"]["enqueued"].asInteger())); - ensure("sd[get_texture_non_temp_http][enqueued] is 0", (0 == sd["get_texture_non_temp_http"]["enqueued"].asInteger())); - ensure("sd[get_texture_temp_http][enqueued] is 0", (0 == sd["get_texture_temp_http"]["enqueued"].asInteger())); - ensure("sd[get_gesture_udp][dequeued] is 0", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); - - // Reset and check zeros... - // Reset leaves current region in place - gViewerAssetStatsMain->reset(); - sd = gViewerAssetStatsMain->asLLSD(false)["regions"][0]; - - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = NULL; - delete gViewerAssetStatsThread1; - gViewerAssetStatsThread1 = NULL; - - ensure("sd[get_texture_non_temp_udp][enqueued] is reset", (0 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger())); - ensure("sd[get_gesture_udp][dequeued] is reset", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); - } - - // Check multiple region collection - template<> template<> - void tst_viewerassetstats_index_object_t::test<6>() - { - gViewerAssetStatsMain = new LLViewerAssetStats(); - - LLViewerAssetStatsFF::set_region_main(region1_handle); + LLViewerAssetStatsFF::set_region(region2_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); - - LLViewerAssetStatsFF::set_region_main(region2_handle); - - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - - LLSD sd = gViewerAssetStatsMain->asLLSD(false); + LLSD sd = gViewerAssetStats->asLLSD(false); // std::cout << sd << std::endl; @@ -414,14 +414,14 @@ namespace tut // Reset and check zeros... // Reset leaves current region in place - gViewerAssetStatsMain->reset(); - sd = gViewerAssetStatsMain->asLLSD(false); + gViewerAssetStats->reset(); + sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); sd2 = sd["regions"][0]; - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = NULL; + delete gViewerAssetStats; + gViewerAssetStats = NULL; ensure("sd2[get_texture_non_temp_udp][enqueued] is reset", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger())); ensure("sd2[get_gesture_udp][enqueued] is reset", (0 == sd2["get_gesture_udp"]["enqueued"].asInteger())); @@ -429,41 +429,41 @@ namespace tut // Check multiple region collection jumping back-and-forth between regions template<> template<> - void tst_viewerassetstats_index_object_t::test<7>() + void tst_viewerassetstats_index_object_t::test<6>() { - gViewerAssetStatsMain = new LLViewerAssetStats(); + gViewerAssetStats = new LLViewerAssetStats(); - LLViewerAssetStatsFF::set_region_main(region1_handle); + LLViewerAssetStatsFF::set_region(region1_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::set_region_main(region2_handle); + LLViewerAssetStatsFF::set_region(region2_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::set_region_main(region1_handle); + LLViewerAssetStatsFF::set_region(region1_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, true, true); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, true, true); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, true, true); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, true, true); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::set_region_main(region2_handle); + LLViewerAssetStatsFF::set_region(region2_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLSD sd = gViewerAssetStatsMain->asLLSD(false); + LLSD sd = gViewerAssetStats->asLLSD(false); ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); @@ -486,15 +486,15 @@ namespace tut // Reset and check zeros... // Reset leaves current region in place - gViewerAssetStatsMain->reset(); - sd = gViewerAssetStatsMain->asLLSD(false); + gViewerAssetStats->reset(); + sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); sd2 = get_region(sd, region2_handle); ensure("Region2 is present in results", sd2.isMap()); - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = NULL; + delete gViewerAssetStats; + gViewerAssetStats = NULL; ensure_equals("sd2[get_texture_non_temp_udp][enqueued] is reset", sd2["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0); ensure_equals("sd2[get_gesture_udp][enqueued] is reset", sd2["get_gesture_udp"]["enqueued"].asInteger(), 0); @@ -502,38 +502,35 @@ namespace tut // Non-texture assets ignore transport and persistence flags template<> template<> - void tst_viewerassetstats_index_object_t::test<8>() + void tst_viewerassetstats_index_object_t::test<7>() { - gViewerAssetStatsThread1 = new LLViewerAssetStats(); - gViewerAssetStatsMain = new LLViewerAssetStats(); - LLViewerAssetStatsFF::set_region_main(region1_handle); + gViewerAssetStats = new LLViewerAssetStats(); + LLViewerAssetStatsFF::set_region(region1_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, true); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, true); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, true); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, true); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, true, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, true, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, true, true); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, true, true); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, true); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, true); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_LSL_BYTECODE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_LSL_BYTECODE, false, true); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, true); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_LSL_BYTECODE, true, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_LSL_BYTECODE, true, true); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - LLSD sd = gViewerAssetStatsThread1->asLLSD(false); - ensure("Other collector is empty", is_no_stats_map(sd)); - sd = gViewerAssetStatsMain->asLLSD(false); + LLSD sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = get_region(sd, region1_handle); @@ -551,445 +548,14 @@ namespace tut // Reset and check zeros... // Reset leaves current region in place - gViewerAssetStatsMain->reset(); - sd = get_region(gViewerAssetStatsMain->asLLSD(false), region1_handle); + gViewerAssetStats->reset(); + sd = get_region(gViewerAssetStats->asLLSD(false), region1_handle); ensure("Region1 is present in results", sd.isMap()); - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = NULL; - delete gViewerAssetStatsThread1; - gViewerAssetStatsThread1 = NULL; + delete gViewerAssetStats; + gViewerAssetStats = NULL; ensure_equals("sd[get_texture_non_temp_udp][enqueued] is reset", sd["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0); ensure_equals("sd[get_gesture_udp][dequeued] is reset", sd["get_gesture_udp"]["dequeued"].asInteger(), 0); } - - - // LLViewerAssetStats::merge() basic functions work - template<> template<> - void tst_viewerassetstats_index_object_t::test<9>() - { - LLViewerAssetStats s1; - LLViewerAssetStats s2; - - s1.setRegion(region1_handle); - s2.setRegion(region1_handle); - - s1.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 5000000); - s1.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 6000000); - s1.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 8000000); - s1.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 7000000); - s1.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 9000000); - - s2.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 2000000); - s2.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 3000000); - s2.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 4000000); - - s2.merge(s1); - - LLSD s2_llsd = get_region(s2.asLLSD(false), region1_handle); - ensure("Region1 is present in results", s2_llsd.isMap()); - - ensure_equals("count after merge", s2_llsd["get_texture_temp_http"]["resp_count"].asInteger(), 8); - ensure_approximately_equals("min after merge", s2_llsd["get_texture_temp_http"]["resp_min"].asReal(), 2.0, 22); - ensure_approximately_equals("max after merge", s2_llsd["get_texture_temp_http"]["resp_max"].asReal(), 9.0, 22); - ensure_approximately_equals("max after merge", s2_llsd["get_texture_temp_http"]["resp_mean"].asReal(), 5.5, 22); - } - - // LLViewerAssetStats::merge() basic functions work without corrupting source data - template<> template<> - void tst_viewerassetstats_index_object_t::test<10>() - { - LLViewerAssetStats s1; - LLViewerAssetStats s2; - - s1.setRegion(region1_handle); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 23289200); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 282900); - - - s2.setRegion(region2_handle); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 6500000); - s2.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 10000); - - { - s2.merge(s1); - - LLSD src = s1.asLLSD(false); - LLSD dst = s2.asLLSD(false); - - ensure_equals("merge src has single region", src["regions"].size(), 1); - ensure_equals("merge dst has dual regions", dst["regions"].size(), 2); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - dst["regions"][1].erase("duration"); - - LLSD s1_llsd = get_region(src, region1_handle); - ensure("Region1 is present in src", s1_llsd.isMap()); - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure("result from src is in dst", llsd_equals(s1_llsd, s2_llsd)); - } - - s1.setRegion(region1_handle); - s2.setRegion(region1_handle); - s1.reset(); - s2.reset(); - - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 23289200); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 282900); - - - s2.setRegion(region1_handle); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 6500000); - s2.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 10000); - - { - s2.merge(s1); - - LLSD src = s1.asLLSD(false); - LLSD dst = s2.asLLSD(false); - - ensure_equals("merge src has single region (p2)", src["regions"].size(), 1); - ensure_equals("merge dst has single region (p2)", dst["regions"].size(), 1); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - - LLSD s1_llsd = get_region(src, region1_handle); - ensure("Region1 is present in src", s1_llsd.isMap()); - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure_equals("src counts okay (enq)", s1_llsd["get_other"]["enqueued"].asInteger(), 4); - ensure_equals("src counts okay (deq)", s1_llsd["get_other"]["dequeued"].asInteger(), 4); - ensure_equals("src resp counts okay", s1_llsd["get_other"]["resp_count"].asInteger(), 2); - ensure_approximately_equals("src respmin okay", s1_llsd["get_other"]["resp_min"].asReal(), 0.2829, 20); - ensure_approximately_equals("src respmax okay", s1_llsd["get_other"]["resp_max"].asReal(), 23.2892, 20); - - ensure_equals("dst counts okay (enq)", s2_llsd["get_other"]["enqueued"].asInteger(), 12); - ensure_equals("src counts okay (deq)", s2_llsd["get_other"]["dequeued"].asInteger(), 11); - ensure_equals("dst resp counts okay", s2_llsd["get_other"]["resp_count"].asInteger(), 4); - ensure_approximately_equals("dst respmin okay", s2_llsd["get_other"]["resp_min"].asReal(), 0.010, 20); - ensure_approximately_equals("dst respmax okay", s2_llsd["get_other"]["resp_max"].asReal(), 23.2892, 20); - } - } - - - // Maximum merges are interesting when one side contributes nothing - template<> template<> - void tst_viewerassetstats_index_object_t::test<11>() - { - LLViewerAssetStats s1; - LLViewerAssetStats s2; - - s1.setRegion(region1_handle); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - // Want to test negative numbers here but have to work in U64 - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - - s2.setRegion(region1_handle); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - { - s2.merge(s1); - - LLSD src = s1.asLLSD(false); - LLSD dst = s2.asLLSD(false); - - ensure_equals("merge src has single region", src["regions"].size(), 1); - ensure_equals("merge dst has single region", dst["regions"].size(), 1); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure_equals("dst counts come from src only", s2_llsd["get_other"]["resp_count"].asInteger(), 3); - - ensure_approximately_equals("dst maximum with count 0 does not contribute to merged maximum", - s2_llsd["get_other"]["resp_max"].asReal(), F64(0.0), 20); - } - - // Other way around - s1.setRegion(region1_handle); - s2.setRegion(region1_handle); - s1.reset(); - s2.reset(); - - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - // Want to test negative numbers here but have to work in U64 - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - { - s1.merge(s2); - - LLSD src = s2.asLLSD(false); - LLSD dst = s1.asLLSD(false); - - ensure_equals("merge src has single region", src["regions"].size(), 1); - ensure_equals("merge dst has single region", dst["regions"].size(), 1); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure_equals("dst counts come from src only (flipped)", s2_llsd["get_other"]["resp_count"].asInteger(), 3); - - ensure_approximately_equals("dst maximum with count 0 does not contribute to merged maximum (flipped)", - s2_llsd["get_other"]["resp_max"].asReal(), F64(0.0), 20); - } - } - - // Minimum merges are interesting when one side contributes nothing - template<> template<> - void tst_viewerassetstats_index_object_t::test<12>() - { - LLViewerAssetStats s1; - LLViewerAssetStats s2; - - s1.setRegion(region1_handle); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 3800000); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 2700000); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 2900000); - - s2.setRegion(region1_handle); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - { - s2.merge(s1); - - LLSD src = s1.asLLSD(false); - LLSD dst = s2.asLLSD(false); - - ensure_equals("merge src has single region", src["regions"].size(), 1); - ensure_equals("merge dst has single region", dst["regions"].size(), 1); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure_equals("dst counts come from src only", s2_llsd["get_other"]["resp_count"].asInteger(), 3); - - ensure_approximately_equals("dst minimum with count 0 does not contribute to merged minimum", - s2_llsd["get_other"]["resp_min"].asReal(), F64(2.7), 20); - } - - // Other way around - s1.setRegion(region1_handle); - s2.setRegion(region1_handle); - s1.reset(); - s2.reset(); - - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 3800000); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 2700000); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 2900000); - - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - { - s1.merge(s2); - - LLSD src = s2.asLLSD(false); - LLSD dst = s1.asLLSD(false); - - ensure_equals("merge src has single region", src["regions"].size(), 1); - ensure_equals("merge dst has single region", dst["regions"].size(), 1); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure_equals("dst counts come from src only (flipped)", s2_llsd["get_other"]["resp_count"].asInteger(), 3); - - ensure_approximately_equals("dst minimum with count 0 does not contribute to merged minimum (flipped)", - s2_llsd["get_other"]["resp_min"].asReal(), F64(2.7), 20); - } - } - } |