SH-2970 FIX - per-region logging of basic avatar stats

master
Brad Payne (Vir Linden) 2012-03-14 17:46:44 -04:00
parent ee758c1da0
commit b4b0800bfd
6 changed files with 47 additions and 2 deletions

0
indra/newview/CMakeLists.txt Normal file → Executable file
View File

View File

@ -4197,6 +4197,7 @@ void LLAppViewer::idle()
// 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(gFPSClamped);
LLViewerAssetStatsFF::record_avatar_stats();
}
}

29
indra/newview/llviewerassetstats.cpp Normal file → Executable file
View File

@ -30,6 +30,7 @@
#include "llregionhandle.h"
#include "stdtypes.h"
#include "llvoavatar.h"
/*
* Classes and utility functions for per-thread and per-region
@ -126,6 +127,8 @@ LLViewerAssetStats::PerRegionStats::merge(const LLViewerAssetStats::PerRegionSta
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)
{
@ -133,6 +136,7 @@ LLViewerAssetStats::PerRegionStats::merge(const LLViewerAssetStats::PerRegionSta
mRequests[i].mDequeued.merge(src.mRequests[i].mDequeued);
mRequests[i].mResponse.merge(src.mRequests[i].mResponse);
}
}
@ -252,6 +256,14 @@ LLViewerAssetStats::recordFPS(F32 fps)
mCurRegionStats->mFPS.record(fps);
}
void
LLViewerAssetStats::recordAvatarStats()
{
std::vector<S32> rez_counts;
LLVOAvatar::getNearbyRezzedStats(rez_counts);
mCurRegionStats->mAvatarRezStates = rez_counts;
}
LLSD
LLViewerAssetStats::asLLSD(bool compact_output)
{
@ -282,6 +294,10 @@ LLViewerAssetStats::asLLSD(bool compact_output)
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");
const duration_t now = LLViewerAssetStatsFF::get_timestamp();
mCurRegionStats->accumulateTime(now);
@ -329,6 +345,11 @@ LLViewerAssetStats::asLLSD(bool compact_output)
slot[max_tag] = LLSD(F64(stats.mFPS.getMax()));
slot[mean_tag] = LLSD(F64(stats.mFPS.getMean()));
}
reg_stat[avatar_tag][avatar_nearby_tag] = LLSD::emptyArray();
for (S32 j = 0; j < stats.mAvatarRezStates.size(); ++j)
{
reg_stat[avatar_tag][avatar_nearby_tag].append(stats.mAvatarRezStates[j]);
}
U32 grid_x(0), grid_y(0);
grid_from_region_handle(it->first, &grid_x, &grid_y);
@ -439,6 +460,14 @@ record_fps_main(F32 fps)
gViewerAssetStatsMain->recordFPS(fps);
}
void
record_avatar_stats()
{
if (! gViewerAssetStatsMain)
return;
gViewerAssetStatsMain->recordAvatarStats();
}
// 'thread1' - should be for TextureFetch thread

8
indra/newview/llviewerassetstats.h Normal file → Executable file
View File

@ -125,7 +125,8 @@ public:
mRegionHandle(src.mRegionHandle),
mTotalTime(src.mTotalTime),
mStartTimestamp(src.mStartTimestamp),
mFPS(src.mFPS)
mFPS(src.mFPS),
mAvatarRezStates(src.mAvatarRezStates)
{
for (int i = 0; i < LL_ARRAY_SIZE(mRequests); ++i)
{
@ -148,6 +149,7 @@ public:
duration_t mTotalTime;
duration_t mStartTimestamp;
LLSimpleStatMMM<> mFPS;
std::vector<S32> mAvatarRezStates;
struct prs_group
{
@ -181,6 +183,9 @@ public:
// Frames-Per-Second Samples
void recordFPS(F32 fps);
// Avatar-related statistics
void recordAvatarStats();
// Merge a source instance into a destination instance. This is
// conceptually an 'operator+=()' method:
// - counts are added
@ -310,6 +315,7 @@ void record_response_main(LLViewerAssetType::EType at, bool with_http, bool is_t
void record_fps_main(F32 fps);
void record_avatar_stats();
/**
* Region context, event and duration loggers for Thread 1.

View File

@ -2141,7 +2141,7 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics()
LLSD msg = metricsData();
msg["message"] = "ViewerAppearanceChangeMetrics";
llinfos << "message: " << msg << llendl;
llinfos << avString() << "message: " << msg << llendl;
std::string caps_url;
if (getRegion())
{

9
indra/newview/tests/llviewerassetstats_test.cpp Normal file → Executable file
View File

@ -35,6 +35,15 @@
#include "lluuid.h"
#include "llsdutil.h"
#include "llregionhandle.h"
#include "../llvoavatar.h"
void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts)
{
counts.resize(3);
counts[0] = 0;
counts[1] = 0;
counts[2] = 1;
}
static const char * all_keys[] =
{