SH-3064 WIP - centralized logic for mapping rez status S32 values to strings

master
Brad Payne (Vir Linden) 2012-04-02 17:26:38 -04:00
parent 02328a13d7
commit 7c14e354ae
5 changed files with 30 additions and 22 deletions

View File

@ -346,11 +346,10 @@ LLViewerAssetStats::asLLSD(bool compact_output)
slot[mean_tag] = LLSD(F64(stats.mFPS.getMean()));
}
reg_stat[avatar_tag][avatar_nearby_tag] = LLSD::emptyArray();
if (stats.mAvatarRezStates.size() > 2)
for (S32 rez_stat=0; rez_stat < stats.mAvatarRezStates.size(); ++rez_stat)
{
reg_stat[avatar_tag][avatar_nearby_tag]["cloud"] = stats.mAvatarRezStates[0];
reg_stat[avatar_tag][avatar_nearby_tag]["gray"] = stats.mAvatarRezStates[1];
reg_stat[avatar_tag][avatar_nearby_tag]["textured"] = stats.mAvatarRezStates[2];
std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat);
reg_stat["nearby"][rez_status_name] = stats.mAvatarRezStates[rez_stat];
}
U32 grid_x(0), grid_y(0);

View File

@ -779,13 +779,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
std::string LLVOAvatar::avString() const
{
std::string viz_string;
if (getIsCloud())
viz_string = "cloud";
else if (isFullyTextured())
viz_string = "textured";
else
viz_string = "gray";
std::string viz_string = LLVOAvatar::rezStatusToString(getRezzedStatus());
return " Avatar '" + getFullname() + "' " + viz_string + " ";
}
@ -1075,6 +1069,15 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts)
}
}
// 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
void LLVOAvatar::dumpBakedStatus()
{
@ -8607,13 +8610,7 @@ void LLVOAvatar::idleUpdateRenderCost()
}
std::string viz_string;
if (getIsCloud())
viz_string = "cloud";
else if (isFullyTextured())
viz_string = "textured";
else
viz_string = "gray";
std::string viz_string = LLVOAvatar::rezStatusToString(getRezzedStatus());
setDebugText(llformat("%s %d", viz_string.c_str(), cost));
mVisualComplexity = cost;
F32 green = 1.f-llclamp(((F32) cost-(F32)ARC_LIMIT)/(F32)ARC_LIMIT, 0.f, 1.f);

View File

@ -555,6 +555,7 @@ public:
BOOL isFullyBaked();
static BOOL areAllNearbyInstancesBaked(S32& grey_avatars);
static void getNearbyRezzedStats(std::vector<S32>& counts);
static std::string rezStatusToString(S32 status);
//--------------------------------------------------------------------
// Baked textures

View File

@ -2128,14 +2128,16 @@ LLSD LLVOAvatarSelf::metricsData()
// runway - add region info
LLSD result;
result["id"] = getID();
result["rez_status"] = getRezzedStatus();
result["rez_status"] = LLVOAvatar::rezStatusToString(getRezzedStatus());
result["is_self"] = isSelf();
std::vector<S32> rez_counts;
LLVOAvatar::getNearbyRezzedStats(rez_counts);
result["nearby"] = LLSD::emptyMap();
result["nearby"]["cloud"] = rez_counts[0];
result["nearby"]["gray"] = rez_counts[1];
result["nearby"]["textured"] = rez_counts[2];
for (S32 i=0; i<rez_counts.size(); ++i)
{
std::string rez_status_name = LLVOAvatar::rezStatusToString(i);
result["nearby"][rez_status_name] = rez_counts[i];
}
result["timers"]["debug_existence"] = mDebugExistenceTimer.getElapsedTimeF32();
result["timers"]["ruth_debug"] = mRuthDebugTimer.getElapsedTimeF32();
result["timers"]["ruth"] = mRuthTimer.getElapsedTimeF32();

View File

@ -45,6 +45,15 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts)
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 const char * all_keys[] =
{
"duration",