diff options
author | Richard Linden <none@none> | 2012-11-05 16:10:57 -0800 |
---|---|---|
committer | Richard Linden <none@none> | 2012-11-05 16:10:57 -0800 |
commit | 0007114cf5a60779319ab8cbd0a23a0d462b8010 (patch) | |
tree | 6bfeb603c3c28f89d1d424abb005741bff7b597a /indra/newview | |
parent | f8eaee753174d0cab4e4edcf795f422706d6f302 (diff) |
SH-3499 WIP Ensure asset stats output is correct
fixed copy behavior of recordings and accumulator buffers
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llviewerassetstats.cpp | 36 | ||||
-rwxr-xr-x | indra/newview/llviewerassetstats.h | 41 | ||||
-rwxr-xr-x | indra/newview/tests/llviewerassetstats_test.cpp | 5 |
4 files changed, 23 insertions, 61 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 2d090f0f74..838a982cb4 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5244,6 +5244,8 @@ void LLAppViewer::metricsSend(bool enable_reporting) // Make a copy of the main stats to send into another thread. // Receiving thread takes ownership. LLViewerAssetStats * main_stats(new LLViewerAssetStats(*gViewerAssetStats)); + + main_stats->updateStats(); // Send a report request into 'thread1' to get the rest of the data // and provide some additional parameters while here. diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index df43c4b344..000d061bec 100755 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -246,9 +246,11 @@ LLViewerAssetStats::LLViewerAssetStats() LLViewerAssetStats::LLViewerAssetStats(const LLViewerAssetStats & src) : mRegionHandle(src.mRegionHandle), mPhaseStats(src.mPhaseStats), - mAvatarRezStates(src.mAvatarRezStates), - mRegionRecordings(src.mRegionRecordings) + mAvatarRezStates(src.mAvatarRezStates) { + src.mCurRecording->update(); + mRegionRecordings = src.mRegionRecordings; + mCurRecording = &mRegionRecordings[mRegionHandle]; } @@ -294,14 +296,17 @@ void LLViewerAssetStats::recordAvatarStats() mPhaseStats["cloud-or-gray"] = LLViewerStats::PhaseMap::getPhaseStats("cloud-or-gray"); } -void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output) +void LLViewerAssetStats::updateStats() { - using namespace LLViewerAssetStatsFF; - - if (mCurRecording) + if (mCurRecording && mCurRecording->isStarted()) { mCurRecording->update(); } +} + +void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output) +{ + using namespace LLViewerAssetStatsFF; stats.regions.setProvided(); @@ -463,25 +468,6 @@ LLSD LLViewerAssetStats::asLLSD(bool compact_output) namespace LLViewerAssetStatsFF { -// -// Target thread is elaborated in the function name. This could -// have been something 'templatey' like specializations iterated -// over a set of constants but with so few, this is clearer I think. -// -// As for the threads themselves... rather than do fine-grained -// locking as we gather statistics, this code creates a collector -// for each thread, allocated and run independently. Logging -// happens at relatively infrequent intervals and at that time -// the data is sent to a single thread to be aggregated into -// a single entity with locks, thread safety and other niceties. -// -// A particularly fussy implementation would distribute the -// per-thread pointers across separate cache lines. But that should -// be beyond current requirements. -// - -// 'main' thread - initial program thread - void set_region(LLViewerAssetStats::region_handle_t region_handle) { if (! gViewerAssetStats) diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h index f1ce3aeaa2..835df89149 100755 --- a/indra/newview/llviewerassetstats.h +++ b/indra/newview/llviewerassetstats.h @@ -192,43 +192,12 @@ public: // Avatar-related statistics void recordAvatarStats(); + // gather latest metrics data + // call from main thread + void updateStats(); + // Retrieve current metrics for all visited regions (NULL region UUID/handle excluded) - // Returned LLSD is structured as follows: - // - // &stats_group = { - // enqueued : int, - // dequeued : int, - // resp_count : int, - // resp_min : float, - // resp_max : float, - // resp_mean : float - // } - // - // &mmm_group = { - // count : int, - // min : float, - // max : float, - // mean : float - // } - // - // { - // duration: int - // regions: { - // $: { // Keys are strings of the region's handle in hex - // duration: : int, - // fps: : &mmm_group, - // get_texture_temp_http : &stats_group, - // get_texture_temp_udp : &stats_group, - // get_texture_non_temp_http : &stats_group, - // get_texture_non_temp_udp : &stats_group, - // get_wearable_udp : &stats_group, - // get_sound_udp : &stats_group, - // get_gesture_udp : &stats_group, - // get_other : &stats_group - // } - // } - // } - // + // Uses AssetStats structure seen above void getStats(AssetStats& stats, bool compact_output); LLSD asLLSD(bool compact_output); diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index 26a76eda2c..1f299abe41 100755 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -340,6 +340,7 @@ namespace tut LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); + gViewerAssetStats->updateStats(); LLSD sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); @@ -377,6 +378,7 @@ namespace tut LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); + gViewerAssetStats->updateStats(); LLSD sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); @@ -422,6 +424,7 @@ namespace tut LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + gViewerAssetStats->updateStats(); LLSD sd = gViewerAssetStats->asLLSD(false); // std::cout << sd << std::endl; @@ -496,6 +499,7 @@ namespace tut LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + gViewerAssetStats->updateStats(); LLSD sd = gViewerAssetStats->asLLSD(false); ensure("Correct double-key LLSD map root", is_triple_key_map(sd, "duration", "regions", "avatar")); @@ -563,6 +567,7 @@ namespace tut LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, true); + gViewerAssetStats->updateStats(); LLSD sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); |