summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerassetstats.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerassetstats.cpp')
-rwxr-xr-xindra/newview/llviewerassetstats.cpp867
1 files changed, 384 insertions, 483 deletions
diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp
index 44e4c54142..cc15d6433f 100755
--- a/indra/newview/llviewerassetstats.cpp
+++ b/indra/newview/llviewerassetstats.cpp
@@ -82,95 +82,7 @@
// ------------------------------------------------------
// Global data definitions
// ------------------------------------------------------
-LLViewerAssetStats * gViewerAssetStatsMain(0);
-LLViewerAssetStats * gViewerAssetStatsThread1(0);
-LLTrace::Count<> LLViewerAssetStats::sEnqueued[EVACCount] = {LLTrace::Count<>("enqueuedassetrequeststemptexturehttp", "Number of temporary texture asset http requests enqueued"),
- LLTrace::Count<>("enqueuedassetrequeststemptextureudp", "Number of temporary texture asset udp requests enqueued"),
- LLTrace::Count<>("enqueuedassetrequestsnontemptexturehttp", "Number of texture asset http requests enqueued"),
- LLTrace::Count<>("enqueuedassetrequestsnontemptextureudp", "Number of texture asset udp requests enqueued"),
- LLTrace::Count<>("enqueuedassetrequestswearableudp", "Number of wearable asset requests enqueued"),
- LLTrace::Count<>("enqueuedassetrequestssoundudp", "Number of sound asset requests enqueued"),
- LLTrace::Count<>("enqueuedassetrequestsgestureudp", "Number of gesture asset requests enqueued"),
- LLTrace::Count<>("enqueuedassetrequestsother", "Number of other asset requests enqueued")};
-LLTrace::Count<> LLViewerAssetStats::sDequeued[EVACCount] = {LLTrace::Count<>("dequeuedassetrequeststemptexturehttp", "Number of temporary texture asset http requests dequeued"),
- LLTrace::Count<>("dequeuedassetrequeststemptextureudp", "Number of temporary texture asset udp requests dequeued"),
- LLTrace::Count<>("dequeuedassetrequestsnontemptexturehttp", "Number of texture asset http requests dequeued"),
- LLTrace::Count<>("dequeuedassetrequestsnontemptextureudp", "Number of texture asset udp requests dequeued"),
- LLTrace::Count<>("dequeuedassetrequestswearableudp", "Number of wearable asset requests dequeued"),
- LLTrace::Count<>("dequeuedassetrequestssoundudp", "Number of sound asset requests dequeued"),
- LLTrace::Count<>("dequeuedassetrequestsgestureudp", "Number of gesture asset requests dequeued"),
- LLTrace::Count<>("dequeuedassetrequestsother", "Number of other asset requests dequeued")};
-LLTrace::Measurement<LLTrace::Seconds> LLViewerAssetStats::sResponse[EVACCount] = {LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimestemptexturehttp", "Time spent responding to temporary texture asset http requests"),
- LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimestemptextureudp", "Time spent responding to temporary texture asset udp requests"),
- LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimesnontemptexturehttp", "Time spent responding to texture asset http requests"),
- LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimesnontemptextureudp", "Time spent responding to texture asset udp requests"),
- LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimeswearableudp", "Time spent responding to wearable asset requests"),
- LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimessoundudp", "Time spent responding to sound asset requests"),
- LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimesgestureudp", "Time spent responding to gesture asset requests"),
- LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimesother", "Time spent responding to other asset requests")};
-
-
-// ------------------------------------------------------
-// Local declarations
-// ------------------------------------------------------
-namespace
-{
-
-static LLViewerAssetStats::EViewerAssetCategories
-asset_type_to_category(const LLViewerAssetType::EType at, bool with_http, bool is_temp);
-
-}
-
-// ------------------------------------------------------
-// LLViewerAssetStats::PerRegionStats struct definition
-// ------------------------------------------------------
-void
-LLViewerAssetStats::PerRegionStats::reset()
-{
- for (int i(0); i < LL_ARRAY_SIZE(mRequests); ++i)
- {
- mRequests[i].mEnqueued.reset();
- mRequests[i].mDequeued.reset();
- mRequests[i].mResponse.reset();
- }
- mFPS.reset();
-
- mTotalTime = 0;
- mStartTimestamp = LLViewerAssetStatsFF::get_timestamp();
-}
-
-
-void
-LLViewerAssetStats::PerRegionStats::merge(const LLViewerAssetStats::PerRegionStats & src)
-{
- // mRegionHandle, mTotalTime, mStartTimestamp are left alone.
-
- // mFPS
- if (src.mFPS.getCount() && mFPS.getCount())
- {
- mFPS.merge(src.mFPS);
- }
-
- // Avatar stats - data all comes from main thread, so leave alone.
-
- // Requests
- for (int i = 0; i < LL_ARRAY_SIZE(mRequests); ++i)
- {
- mRequests[i].mEnqueued.merge(src.mRequests[i].mEnqueued);
- mRequests[i].mDequeued.merge(src.mRequests[i].mDequeued);
- mRequests[i].mResponse.merge(src.mRequests[i].mResponse);
- }
-
-}
-
-
-void
-LLViewerAssetStats::PerRegionStats::accumulateTime(duration_t now)
-{
- mTotalTime += (now - mStartTimestamp);
- mStartTimestamp = now;
-}
-
+LLViewerAssetStats * gViewerAssetStats(0);
// ------------------------------------------------------
// LLViewerAssetStats class definition
@@ -183,47 +95,25 @@ LLViewerAssetStats::LLViewerAssetStats()
LLViewerAssetStats::LLViewerAssetStats(const LLViewerAssetStats & src)
- : mRegionHandle(src.mRegionHandle),
- mResetTimestamp(src.mResetTimestamp),
- mPhaseStats(src.mPhaseStats),
- mAvatarRezStates(src.mAvatarRezStates)
+: mRegionHandle(src.mRegionHandle),
+ mPhaseStats(src.mPhaseStats),
+ mAvatarRezStates(src.mAvatarRezStates),
+ mRegionRecordings(src.mRegionRecordings)
{
- const PerRegionContainer::const_iterator it_end(src.mRegionStats.end());
- for (PerRegionContainer::const_iterator it(src.mRegionStats.begin()); it_end != it; ++it)
- {
- mRegionStats[it->first] = new PerRegionStats(*it->second);
- }
- mCurRegionStats = mRegionStats[mRegionHandle];
+ mCurRecording = &mRegionRecordings[mRegionHandle];
}
-void
-LLViewerAssetStats::reset()
+void LLViewerAssetStats::reset()
{
// Empty the map of all region stats
- mRegionStats.clear();
-
- // If we have a current stats, reset it, otherwise, as at construction,
- // create a new one as we must always have a current stats block.
- if (mCurRegionStats)
- {
- mCurRegionStats->reset();
- }
- else
- {
- mCurRegionStats = new PerRegionStats(mRegionHandle);
- }
+ mRegionRecordings.clear();
- // And add reference to map
- mRegionStats[mRegionHandle] = mCurRegionStats;
-
- // Start timestamp consistent with per-region collector
- mResetTimestamp = mCurRegionStats->mStartTimestamp;
+ // initialize new recording for current region
+ mCurRecording = &mRegionRecordings[mRegionHandle];
}
-
-void
-LLViewerAssetStats::setRegion(region_handle_t region_handle)
+void LLViewerAssetStats::setRegion(region_handle_t region_handle)
{
if (region_handle == mRegionHandle)
{
@@ -231,207 +121,386 @@ LLViewerAssetStats::setRegion(region_handle_t region_handle)
return;
}
- // Get duration for current set
- const duration_t now = LLViewerAssetStatsFF::get_timestamp();
- mCurRegionStats->accumulateTime(now);
+ mCurRecording->stop();
+ mCurRecording = &mRegionRecordings[region_handle];
+ mCurRecording->start();
- // Prepare new set
- PerRegionContainer::iterator new_stats = mRegionStats.find(region_handle);
- if (mRegionStats.end() == new_stats)
- {
- // Haven't seen this region_id before, create a new block and make it current.
- mCurRegionStats = new PerRegionStats(region_handle);
- mRegionStats[region_handle] = mCurRegionStats;
- }
- else
- {
- mCurRegionStats = new_stats->second;
- }
- mCurRegionStats->mStartTimestamp = now;
mRegionHandle = region_handle;
}
-
-void
-LLViewerAssetStats::recordGetEnqueued(LLViewerAssetType::EType at, bool with_http, bool is_temp)
+void LLViewerAssetStats::recordAvatarStats()
{
- const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
-
- ++(mCurRegionStats->mRequests[int(eac)].mEnqueued);
- sEnqueued[int(eac)].add(1);
+ LLVOAvatar::getNearbyRezzedStats(mAvatarRezStates);
+ mPhaseStats.clear();
+ mPhaseStats["cloud"] = LLViewerStats::PhaseMap::getPhaseStats("cloud");
+ mPhaseStats["cloud-or-gray"] = LLViewerStats::PhaseMap::getPhaseStats("cloud-or-gray");
}
+
+struct AssetRequestType : public LLInitParam::Block<AssetRequestType>
+{
+ Optional<S32> enqueued,
+ dequeued,
+ resp_count;
+ Optional<F64> resp_min,
+ resp_max,
+ resp_mean;
-void
-LLViewerAssetStats::recordGetDequeued(LLViewerAssetType::EType at, bool with_http, bool is_temp)
+ AssetRequestType()
+ : enqueued("enqueued"),
+ dequeued("dequeued"),
+ resp_count("resp_count"),
+ resp_min("resp_min"),
+ resp_max("resp_max"),
+ resp_mean("resp_mean")
+ {}
+};
+
+struct FPSStats : public LLInitParam::Block<FPSStats>
{
- const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
+ Optional<S32> count;
+ Optional<F64> min,
+ max,
+ mean;
+ FPSStats()
+ : count("count"),
+ min("min"),
+ max("max"),
+ mean("mean")
+ {}
+};
+
+struct RegionStats : public LLInitParam::Block<RegionStats>
+{
+ Optional<AssetRequestType> get_texture_temp_http,
+ get_texture_temp_udp,
+ get_texture_non_temp_http,
+ get_texture_non_temp_udp,
+ get_wearable_udp,
+ get_sound_udp,
+ get_gesture_udp,
+ get_other;
+ Optional<FPSStats> fps;
+ Mandatory<S32> grid_x,
+ grid_y;
+ Mandatory<F64> duration;
+
+ RegionStats()
+ : get_texture_temp_http("get_texture_temp_http"),
+ get_texture_temp_udp("get_texture_temp_udp"),
+ get_texture_non_temp_http("get_texture_non_temp_http"),
+ get_texture_non_temp_udp("get_texture_non_temp_udp"),
+ get_wearable_udp("get_wearable_udp"),
+ get_sound_udp("get_sound_udp"),
+ get_gesture_udp("get_gesture_udp"),
+ get_other("get_other"),
+ fps("fps"),
+ grid_x("grid_x"),
+ grid_y("grid_y"),
+ duration("duration")
+ {}
+};
+
+struct AvatarRezState : public LLInitParam::Block<AvatarRezState>
+{
+ Mandatory<S32> cloud,
+ gray,
+ textured;
+ AvatarRezState()
+ : cloud("cloud"),
+ gray("gray"),
+ textured("textured")
+ {}
+};
+
+struct AvatarPhaseStats : public LLInitParam::Block<AvatarPhaseStats>
+{
+ Mandatory<LLSD> cloud,
+ cloud_or_gray;
- ++(mCurRegionStats->mRequests[int(eac)].mDequeued);
- sDequeued[int(eac)].add(1);
-}
+ AvatarPhaseStats()
+ : cloud("cloud"),
+ cloud_or_gray("cloud-or-gray")
+ {}
+};
-void
-LLViewerAssetStats::recordGetServiced(LLViewerAssetType::EType at, bool with_http, bool is_temp, duration_t duration)
+struct AvatarInfo : public LLInitParam::Block<AvatarInfo>
{
- const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
+ Mandatory<AvatarRezState> nearby;
+ Mandatory<AvatarPhaseStats> phase_stats;
- mCurRegionStats->mRequests[int(eac)].mResponse.record(duration);
- sResponse[int(eac)].sample<LLTrace::Seconds>(duration);
-}
+ AvatarInfo()
+ : nearby("nearby"),
+ phase_stats("phase_stats")
+ {}
+};
-void
-LLViewerAssetStats::recordFPS(F32 fps)
+struct AssetStats : public LLInitParam::Block<AssetStats>
{
- mCurRegionStats->mFPS.record(fps);
-}
+ Multiple<RegionStats> regions;
+ Mandatory<F64> duration;
+
+ AssetStats()
+ : regions("regions"),
+ duration("duration")
+ {}
+
+};
+
+//LLSD LLViewerAssetStats::asLLSD(bool compact_output)
+//{
+// // Top-level tags
+// static const LLSD::String tags[LLViewerAssetStatsFF::EVACCount] =
+// {
+// LLSD::String("get_texture_temp_http"),
+// LLSD::String("get_texture_temp_udp"),
+// LLSD::String("get_texture_non_temp_http"),
+// LLSD::String("get_texture_non_temp_udp"),
+// LLSD::String("get_wearable_udp"),
+// LLSD::String("get_sound_udp"),
+// LLSD::String("get_gesture_udp"),
+// LLSD::String("get_other")
+// };
+//
+// // Stats Group Sub-tags.
+// static const LLSD::String enq_tag("enqueued");
+// static const LLSD::String deq_tag("dequeued");
+// static const LLSD::String rcnt_tag("resp_count");
+// static const LLSD::String rmin_tag("resp_min");
+// static const LLSD::String rmax_tag("resp_max");
+// static const LLSD::String rmean_tag("resp_mean");
+//
+// // MMM Group Sub-tags.
+// static const LLSD::String cnt_tag("count");
+// static const LLSD::String min_tag("min");
+// static const LLSD::String max_tag("max");
+// static const LLSD::String mean_tag("mean");
+//
+// // Avatar sub-tags
+// static const LLSD::String avatar_tag("avatar");
+// static const LLSD::String avatar_nearby_tag("nearby");
+// static const LLSD::String avatar_phase_stats_tag("phase_stats");
+//
+// const duration_t now = LLViewerAssetStatsFF::get_timestamp();
+// mCurRegionStats->accumulateTime(now);
+//
+// LLSD regions = LLSD::emptyArray();
+// for (PerRegionContainer::iterator it = mRegionStats.begin();
+// mRegionStats.end() != it;
+// ++it)
+// {
+// if (0 == it->first)
+// {
+// // Never emit NULL UUID/handle in results.
+// continue;
+// }
+//
+// PerRegionStats & stats = *it->second;
+//
+// LLSD reg_stat = LLSD::emptyMap();
+//
+// for (int i = 0; i < LL_ARRAY_SIZE(tags); ++i)
+// {
+// 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();
+// slot[cnt_tag] = LLSD(S32(stats.mFPS.getCount()));
+// slot[min_tag] = LLSD(F64(stats.mFPS.getMin()));
+// slot[max_tag] = LLSD(F64(stats.mFPS.getMax()));
+// slot[mean_tag] = LLSD(F64(stats.mFPS.getMean()));
+// }
+// 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();
+// ret["regions"] = regions;
+// ret["duration"] = LLSD::Real((now - mResetTimestamp) * 1.0e-6);
+// LLSD avatar_info;
+// avatar_info[avatar_nearby_tag] = LLSD::emptyArray();
+// for (S32 rez_stat=0; rez_stat < mAvatarRezStates.size(); ++rez_stat)
+// {
+// std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat);
+// avatar_info[avatar_nearby_tag][rez_status_name] = mAvatarRezStates[rez_stat];
+// }
+// avatar_info[avatar_phase_stats_tag]["cloud"] = mPhaseStats["cloud"].asLLSD();
+// avatar_info[avatar_phase_stats_tag]["cloud-or-gray"] = mPhaseStats["cloud-or-gray"].asLLSD();
+// ret[avatar_tag] = avatar_info;
+//
+// return ret;
+//}
-void
-LLViewerAssetStats::recordAvatarStats()
-{
- std::vector<S32> rez_counts;
- LLVOAvatar::getNearbyRezzedStats(rez_counts);
- mAvatarRezStates = rez_counts;
- mPhaseStats.clear();
- mPhaseStats["cloud"] = LLViewerStats::PhaseMap::getPhaseStats("cloud");
- mPhaseStats["cloud-or-gray"] = LLViewerStats::PhaseMap::getPhaseStats("cloud-or-gray");
-}
+// ------------------------------------------------------
+// Global free-function definitions (LLViewerAssetStatsFF namespace)
+// ------------------------------------------------------
-LLSD
-LLViewerAssetStats::asLLSD(bool compact_output)
+namespace LLViewerAssetStatsFF
{
- // Top-level tags
- static const LLSD::String tags[EVACCount] =
+ static EViewerAssetCategories asset_type_to_category(const LLViewerAssetType::EType at, bool with_http, bool is_temp)
+ {
+ // For statistical purposes, we divide GETs into several
+ // populations of asset fetches:
+ // - textures which are de-prioritized in the asset system
+ // - wearables (clothing, bodyparts) which directly affect
+ // user experiences when they log in
+ // - sounds
+ // - gestures
+ // - everything else.
+ //
+ llassert_always(50 == LLViewerAssetType::AT_COUNT);
+
+ // Multiple asset definitions are floating around so this requires some
+ // maintenance and attention.
+ static const EViewerAssetCategories asset_to_bin_map[LLViewerAssetType::AT_COUNT] =
{
- LLSD::String("get_texture_temp_http"),
- LLSD::String("get_texture_temp_udp"),
- LLSD::String("get_texture_non_temp_http"),
- LLSD::String("get_texture_non_temp_udp"),
- LLSD::String("get_wearable_udp"),
- LLSD::String("get_sound_udp"),
- LLSD::String("get_gesture_udp"),
- LLSD::String("get_other")
+ EVACTextureTempHTTPGet, // (0) AT_TEXTURE
+ EVACSoundUDPGet, // AT_SOUND
+ EVACOtherGet, // AT_CALLINGCARD
+ EVACOtherGet, // AT_LANDMARK
+ EVACOtherGet, // AT_SCRIPT
+ EVACWearableUDPGet, // AT_CLOTHING
+ EVACOtherGet, // AT_OBJECT
+ EVACOtherGet, // AT_NOTECARD
+ EVACOtherGet, // AT_CATEGORY
+ EVACOtherGet, // AT_ROOT_CATEGORY
+ EVACOtherGet, // (10) AT_LSL_TEXT
+ EVACOtherGet, // AT_LSL_BYTECODE
+ EVACOtherGet, // AT_TEXTURE_TGA
+ EVACWearableUDPGet, // AT_BODYPART
+ EVACOtherGet, // AT_TRASH
+ EVACOtherGet, // AT_SNAPSHOT_CATEGORY
+ EVACOtherGet, // AT_LOST_AND_FOUND
+ EVACSoundUDPGet, // AT_SOUND_WAV
+ EVACOtherGet, // AT_IMAGE_TGA
+ EVACOtherGet, // AT_IMAGE_JPEG
+ EVACGestureUDPGet, // (20) AT_ANIMATION
+ EVACGestureUDPGet, // AT_GESTURE
+ EVACOtherGet, // AT_SIMSTATE
+ EVACOtherGet, // AT_FAVORITE
+ EVACOtherGet, // AT_LINK
+ EVACOtherGet, // AT_LINK_FOLDER
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, // (30)
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, // (40)
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, //
+ EVACOtherGet, // AT_MESH
+ // (50)
};
- // Stats Group Sub-tags.
- static const LLSD::String enq_tag("enqueued");
- static const LLSD::String deq_tag("dequeued");
- static const LLSD::String rcnt_tag("resp_count");
- static const LLSD::String rmin_tag("resp_min");
- static const LLSD::String rmax_tag("resp_max");
- static const LLSD::String rmean_tag("resp_mean");
-
- // MMM Group Sub-tags.
- static const LLSD::String cnt_tag("count");
- static const LLSD::String min_tag("min");
- static const LLSD::String max_tag("max");
- static const LLSD::String mean_tag("mean");
-
- // Avatar sub-tags
- static const LLSD::String avatar_tag("avatar");
- static const LLSD::String avatar_nearby_tag("nearby");
- static const LLSD::String avatar_phase_stats_tag("phase_stats");
-
- const duration_t now = LLViewerAssetStatsFF::get_timestamp();
- mCurRegionStats->accumulateTime(now);
-
- LLSD regions = LLSD::emptyArray();
- for (PerRegionContainer::iterator it = mRegionStats.begin();
- mRegionStats.end() != it;
- ++it)
- {
- if (0 == it->first)
+ if (at < 0 || at >= LLViewerAssetType::AT_COUNT)
{
- // Never emit NULL UUID/handle in results.
- continue;
+ return EVACOtherGet;
}
-
- PerRegionStats & stats = *it->second;
-
- LLSD reg_stat = LLSD::emptyMap();
-
- for (int i = 0; i < LL_ARRAY_SIZE(tags); ++i)
+ EViewerAssetCategories ret(asset_to_bin_map[at]);
+ if (EVACTextureTempHTTPGet == ret)
{
- PerRegionStats::prs_group & group(stats.mRequests[i]);
-
- if ((! compact_output) ||
- group.mEnqueued.getCount() ||
- group.mDequeued.getCount() ||
- group.mResponse.getCount())
+ // Indexed with [is_temp][with_http]
+ static const EViewerAssetCategories texture_bin_map[2][2] =
{
- 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();
- slot[cnt_tag] = LLSD(S32(stats.mFPS.getCount()));
- slot[min_tag] = LLSD(F64(stats.mFPS.getMin()));
- slot[max_tag] = LLSD(F64(stats.mFPS.getMax()));
- slot[mean_tag] = LLSD(F64(stats.mFPS.getMean()));
- }
- 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();
- ret["regions"] = regions;
- ret["duration"] = LLSD::Real((now - mResetTimestamp) * 1.0e-6);
- LLSD avatar_info;
- avatar_info[avatar_nearby_tag] = LLSD::emptyArray();
- for (S32 rez_stat=0; rez_stat < mAvatarRezStates.size(); ++rez_stat)
- {
- std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat);
- avatar_info[avatar_nearby_tag][rez_status_name] = mAvatarRezStates[rez_stat];
- }
- avatar_info[avatar_phase_stats_tag]["cloud"] = mPhaseStats["cloud"].asLLSD();
- avatar_info[avatar_phase_stats_tag]["cloud-or-gray"] = mPhaseStats["cloud-or-gray"].asLLSD();
- ret[avatar_tag] = avatar_info;
-
- return ret;
-}
-
-void
-LLViewerAssetStats::merge(const LLViewerAssetStats & src)
-{
- // mRegionHandle, mCurRegionStats and mResetTimestamp are left untouched.
- // Just merge the stats bodies
+ {
+ EVACTextureNonTempUDPGet,
+ EVACTextureNonTempHTTPGet,
+ },
+ {
+ EVACTextureTempUDPGet,
+ EVACTextureTempHTTPGet,
+ }
+ };
- const PerRegionContainer::const_iterator it_end(src.mRegionStats.end());
- for (PerRegionContainer::const_iterator it(src.mRegionStats.begin()); it_end != it; ++it)
- {
- PerRegionContainer::iterator dst(mRegionStats.find(it->first));
- if (mRegionStats.end() == dst)
- {
- // Destination is missing data, just make a private copy
- mRegionStats[it->first] = new PerRegionStats(*it->second);
- }
- else
- {
- dst->second->merge(*it->second);
+ ret = texture_bin_map[is_temp][with_http];
}
+ return ret;
}
-}
-
-
-// ------------------------------------------------------
-// Global free-function definitions (LLViewerAssetStatsFF namespace)
-// ------------------------------------------------------
-
-namespace LLViewerAssetStatsFF
-{
+static LLTrace::Count<> sEnqueued[EVACCount] = {LLTrace::Count<>("enqueuedassetrequeststemptexturehttp",
+ "Number of temporary texture asset http requests enqueued"),
+ LLTrace::Count<>("enqueuedassetrequeststemptextureudp",
+ "Number of temporary texture asset udp requests enqueued"),
+ LLTrace::Count<>("enqueuedassetrequestsnontemptexturehttp",
+ "Number of texture asset http requests enqueued"),
+ LLTrace::Count<>("enqueuedassetrequestsnontemptextureudp",
+ "Number of texture asset udp requests enqueued"),
+ LLTrace::Count<>("enqueuedassetrequestswearableudp",
+ "Number of wearable asset requests enqueued"),
+ LLTrace::Count<>("enqueuedassetrequestssoundudp",
+ "Number of sound asset requests enqueued"),
+ LLTrace::Count<>("enqueuedassetrequestsgestureudp",
+ "Number of gesture asset requests enqueued"),
+ LLTrace::Count<>("enqueuedassetrequestsother",
+ "Number of other asset requests enqueued")};
+
+static LLTrace::Count<> sDequeued[EVACCount] = {LLTrace::Count<>("dequeuedassetrequeststemptexturehttp",
+ "Number of temporary texture asset http requests dequeued"),
+ LLTrace::Count<>("dequeuedassetrequeststemptextureudp",
+ "Number of temporary texture asset udp requests dequeued"),
+ LLTrace::Count<>("dequeuedassetrequestsnontemptexturehttp",
+ "Number of texture asset http requests dequeued"),
+ LLTrace::Count<>("dequeuedassetrequestsnontemptextureudp",
+ "Number of texture asset udp requests dequeued"),
+ LLTrace::Count<>("dequeuedassetrequestswearableudp",
+ "Number of wearable asset requests dequeued"),
+ LLTrace::Count<>("dequeuedassetrequestssoundudp",
+ "Number of sound asset requests dequeued"),
+ LLTrace::Count<>("dequeuedassetrequestsgestureudp",
+ "Number of gesture asset requests dequeued"),
+ LLTrace::Count<>("dequeuedassetrequestsother",
+ "Number of other asset requests dequeued")};
+static LLTrace::Measurement<LLTrace::Seconds> sResponse[EVACCount] = {LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimestemptexturehttp",
+ "Time spent responding to temporary texture asset http requests"),
+ LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimestemptextureudp",
+ "Time spent responding to temporary texture asset udp requests"),
+ LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimesnontemptexturehttp",
+ "Time spent responding to texture asset http requests"),
+ LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimesnontemptextureudp",
+ "Time spent responding to texture asset udp requests"),
+ LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimeswearableudp",
+ "Time spent responding to wearable asset requests"),
+ LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimessoundudp",
+ "Time spent responding to sound asset requests"),
+ LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimesgestureudp",
+ "Time spent responding to gesture asset requests"),
+ LLTrace::Measurement<LLTrace::Seconds>("assetresponsetimesother",
+ "Time spent responding to other asset requests")};
//
// Target thread is elaborated in the function name. This could
@@ -452,227 +521,59 @@ namespace LLViewerAssetStatsFF
// 'main' thread - initial program thread
-void
-set_region_main(LLViewerAssetStats::region_handle_t region_handle)
+void set_region(LLViewerAssetStats::region_handle_t region_handle)
{
- if (! gViewerAssetStatsMain)
+ if (! gViewerAssetStats)
return;
- gViewerAssetStatsMain->setRegion(region_handle);
+ gViewerAssetStats->setRegion(region_handle);
}
-void
-record_enqueue_main(LLViewerAssetType::EType at, bool with_http, bool is_temp)
+void record_enqueue(LLViewerAssetType::EType at, bool with_http, bool is_temp)
{
- if (! gViewerAssetStatsMain)
- return;
-
- gViewerAssetStatsMain->recordGetEnqueued(at, with_http, is_temp);
-}
-
-void
-record_dequeue_main(LLViewerAssetType::EType at, bool with_http, bool is_temp)
-{
- if (! gViewerAssetStatsMain)
- return;
-
- gViewerAssetStatsMain->recordGetDequeued(at, with_http, is_temp);
-}
-
-void
-record_response_main(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration)
-{
- if (! gViewerAssetStatsMain)
- return;
-
- gViewerAssetStatsMain->recordGetServiced(at, with_http, is_temp, duration);
-}
-
-void
-record_fps_main(F32 fps)
-{
- if (! gViewerAssetStatsMain)
- return;
-
- gViewerAssetStatsMain->recordFPS(fps);
-}
-
-void
-record_avatar_stats()
-{
- if (! gViewerAssetStatsMain)
- return;
+ const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
- gViewerAssetStatsMain->recordAvatarStats();
+ sEnqueued[int(eac)].add(1);
}
-// 'thread1' - should be for TextureFetch thread
-
-void
-set_region_thread1(LLViewerAssetStats::region_handle_t region_handle)
+void record_dequeue(LLViewerAssetType::EType at, bool with_http, bool is_temp)
{
- if (! gViewerAssetStatsThread1)
- return;
-
- gViewerAssetStatsThread1->setRegion(region_handle);
-}
-
-void
-record_enqueue_thread1(LLViewerAssetType::EType at, bool with_http, bool is_temp)
-{
- if (! gViewerAssetStatsThread1)
- return;
+ const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
- gViewerAssetStatsThread1->recordGetEnqueued(at, with_http, is_temp);
+ sDequeued[int(eac)].add(1);
}
-void
-record_dequeue_thread1(LLViewerAssetType::EType at, bool with_http, bool is_temp)
+void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration)
{
- if (! gViewerAssetStatsThread1)
- return;
+ const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
- gViewerAssetStatsThread1->recordGetDequeued(at, with_http, is_temp);
+ sResponse[int(eac)].sample<LLTrace::Seconds>(duration);
}
-void
-record_response_thread1(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration)
+void record_avatar_stats()
{
- if (! gViewerAssetStatsThread1)
+ if (! gViewerAssetStats)
return;
- gViewerAssetStatsThread1->recordGetServiced(at, with_http, is_temp, duration);
+ gViewerAssetStats->recordAvatarStats();
}
-
-void
-init()
+void init()
{
- if (! gViewerAssetStatsMain)
+ if (! gViewerAssetStats)
{
- gViewerAssetStatsMain = new LLViewerAssetStats();
- }
- if (! gViewerAssetStatsThread1)
- {
- gViewerAssetStatsThread1 = new LLViewerAssetStats();
+ gViewerAssetStats = new LLViewerAssetStats();
}
}
void
cleanup()
{
- delete gViewerAssetStatsMain;
- gViewerAssetStatsMain = 0;
-
- delete gViewerAssetStatsThread1;
- gViewerAssetStatsThread1 = 0;
+ delete gViewerAssetStats;
+ gViewerAssetStats = 0;
}
} // namespace LLViewerAssetStatsFF
-// ------------------------------------------------------
-// Local function definitions
-// ------------------------------------------------------
-
-namespace
-{
-
-LLViewerAssetStats::EViewerAssetCategories
-asset_type_to_category(const LLViewerAssetType::EType at, bool with_http, bool is_temp)
-{
- // For statistical purposes, we divide GETs into several
- // populations of asset fetches:
- // - textures which are de-prioritized in the asset system
- // - wearables (clothing, bodyparts) which directly affect
- // user experiences when they log in
- // - sounds
- // - gestures
- // - everything else.
- //
- llassert_always(50 == LLViewerAssetType::AT_COUNT);
-
- // Multiple asset definitions are floating around so this requires some
- // maintenance and attention.
- static const LLViewerAssetStats::EViewerAssetCategories asset_to_bin_map[LLViewerAssetType::AT_COUNT] =
- {
- LLViewerAssetStats::EVACTextureTempHTTPGet, // (0) AT_TEXTURE
- LLViewerAssetStats::EVACSoundUDPGet, // AT_SOUND
- LLViewerAssetStats::EVACOtherGet, // AT_CALLINGCARD
- LLViewerAssetStats::EVACOtherGet, // AT_LANDMARK
- LLViewerAssetStats::EVACOtherGet, // AT_SCRIPT
- LLViewerAssetStats::EVACWearableUDPGet, // AT_CLOTHING
- LLViewerAssetStats::EVACOtherGet, // AT_OBJECT
- LLViewerAssetStats::EVACOtherGet, // AT_NOTECARD
- LLViewerAssetStats::EVACOtherGet, // AT_CATEGORY
- LLViewerAssetStats::EVACOtherGet, // AT_ROOT_CATEGORY
- LLViewerAssetStats::EVACOtherGet, // (10) AT_LSL_TEXT
- LLViewerAssetStats::EVACOtherGet, // AT_LSL_BYTECODE
- LLViewerAssetStats::EVACOtherGet, // AT_TEXTURE_TGA
- LLViewerAssetStats::EVACWearableUDPGet, // AT_BODYPART
- LLViewerAssetStats::EVACOtherGet, // AT_TRASH
- LLViewerAssetStats::EVACOtherGet, // AT_SNAPSHOT_CATEGORY
- LLViewerAssetStats::EVACOtherGet, // AT_LOST_AND_FOUND
- LLViewerAssetStats::EVACSoundUDPGet, // AT_SOUND_WAV
- LLViewerAssetStats::EVACOtherGet, // AT_IMAGE_TGA
- LLViewerAssetStats::EVACOtherGet, // AT_IMAGE_JPEG
- LLViewerAssetStats::EVACGestureUDPGet, // (20) AT_ANIMATION
- LLViewerAssetStats::EVACGestureUDPGet, // AT_GESTURE
- LLViewerAssetStats::EVACOtherGet, // AT_SIMSTATE
- LLViewerAssetStats::EVACOtherGet, // AT_FAVORITE
- LLViewerAssetStats::EVACOtherGet, // AT_LINK
- LLViewerAssetStats::EVACOtherGet, // AT_LINK_FOLDER
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, // (30)
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, // (40)
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, //
- LLViewerAssetStats::EVACOtherGet, // AT_MESH
- // (50)
- };
-
- if (at < 0 || at >= LLViewerAssetType::AT_COUNT)
- {
- return LLViewerAssetStats::EVACOtherGet;
- }
- LLViewerAssetStats::EViewerAssetCategories ret(asset_to_bin_map[at]);
- if (LLViewerAssetStats::EVACTextureTempHTTPGet == ret)
- {
- // Indexed with [is_temp][with_http]
- static const LLViewerAssetStats::EViewerAssetCategories texture_bin_map[2][2] =
- {
- {
- LLViewerAssetStats::EVACTextureNonTempUDPGet,
- LLViewerAssetStats::EVACTextureNonTempHTTPGet,
- },
- {
- LLViewerAssetStats::EVACTextureTempUDPGet,
- LLViewerAssetStats::EVACTextureTempHTTPGet,
- }
- };
-
- ret = texture_bin_map[is_temp][with_http];
- }
- return ret;
-}
-
-} // anonymous namespace