summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llvoavatar.cpp14
-rwxr-xr-xindra/newview/llvoavatarself.cpp89
-rwxr-xr-xindra/newview/llvoavatarself.h6
3 files changed, 99 insertions, 10 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index f7e1944660..e911e01420 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -99,6 +99,7 @@
#include "lldebugmessagebox.h"
#include "llsdutil.h"
+#include "llsdserialize.h"
extern F32 SPEED_ADJUST_MAX;
extern F32 SPEED_ADJUST_MAX_SEC;
@@ -5964,12 +5965,13 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse
LLSD record;
record["timer_name"] = phase_name;
record["agent_id"] = gAgent.getID();
+ record["avatar_id"] = getID();
record["elapsed"] = elapsed;
record["completed"] = completed;
U32 grid_x(0), grid_y(0);
if (getRegion())
{
- record["cbv"] = getRegion()->getCentralBakeVersion();
+ record["central_bake_version"] = getRegion()->getCentralBakeVersion();
grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y);
}
record["grid_x"] = LLSD::Integer(grid_x);
@@ -5977,7 +5979,15 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse
record["is_using_server_bake"] = isUsingServerBakes();
record["is_self"] = isSelf();
- LL_DEBUGS("Avatar") << "record\n" << ll_pretty_print_sd(record) << llendl;
+
+ std::ostringstream ostr;
+ ostr << LLSDNotationStreamer(record);
+ LL_DEBUGS("Avatar") << "record\n" << ostr.str() << llendl;
+
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->addMetricsTimerRecord(record);
+ }
}
void LLVOAvatar::stopPhase(const std::string& phase_name)
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 3ae4f9bc71..4461ba32c5 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -62,6 +62,7 @@
#include "llvovolume.h"
#include "llsdutil.h"
#include "llstartup.h"
+#include "llsdserialize.h"
#if LL_MSVC
// disable boost::lexical_cast warning
@@ -2166,6 +2167,8 @@ const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const
return text;
}
+
+#if 0
// Dump avatar metrics data.
LLSD LLVOAvatarSelf::metricsData()
{
@@ -2178,10 +2181,10 @@ LLSD LLVOAvatarSelf::metricsData()
result["timers"]["invisible"] = mInvisibleTimer.getElapsedTimeF32();
result["timers"]["fully_loaded"] = mFullyLoadedTimer.getElapsedTimeF32();
result["startup"] = LLStartUp::getPhases().dumpPhases();
- result["phases"] = getPhases().dumpPhases();
return result;
}
+#endif
class ViewerAppearanceChangeMetricsResponder: public LLCurl::Responder
{
@@ -2241,19 +2244,65 @@ bool LLVOAvatarSelf::updateAvatarRezMetrics(bool force_send)
// complete. This will give us stats for any timers that
// haven't finished as of the metric's being sent.
LLVOAvatar::logPendingPhasesAllAvatars();
- sendAppearanceChangeMetrics();
+ sendViewerAppearanceChangeMetrics();
}
return false;
}
-void LLVOAvatarSelf::sendAppearanceChangeMetrics()
+void LLVOAvatarSelf::addMetricsTimerRecord(const LLSD& record)
+{
+ mPendingTimerRecords.push_back(record);
+}
+
+bool operator<(const LLSD& a, const LLSD& b)
+{
+ std::ostringstream aout, bout;
+ aout << LLSDNotationStreamer(a);
+ bout << LLSDNotationStreamer(b);
+ return aout.str() < bout.str();
+
+}
+
+// Given a vector of LLSD records, return an LLSD array of bucketed stats for val_field.
+LLSD summarize_by_buckets(std::vector<LLSD> in_records,
+ std::vector<std::string> by_fields,
+ std::string& val_field)
+{
+ LLSD result = LLSD::emptyArray();
+ std::map<LLSD,LLViewerStats::StatsAccumulator> accum;
+ for (std::vector<LLSD>::iterator in_record_iter = in_records.begin();
+ in_record_iter != in_records.end(); ++in_record_iter)
+ {
+ LLSD& record = *in_record_iter;
+ LLSD key;
+ for (std::vector<std::string>::iterator field_iter = by_fields.begin();
+ field_iter != by_fields.end(); ++field_iter)
+ {
+ const std::string& field = *field_iter;
+ key[field] = record[field];
+ LLViewerStats::StatsAccumulator& stats = accum[key];
+ F32 value = record[val_field].asReal();
+ stats.push(value);
+ }
+ }
+ for (std::map<LLSD,LLViewerStats::StatsAccumulator>::iterator accum_it = accum.begin();
+ accum_it != accum.end(); ++accum_it)
+ {
+ LLSD out_record = accum_it->first;
+ out_record["stats"] = accum_it->second.getData();
+ result.append(out_record);
+ }
+ return result;
+}
+
+void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics()
{
// gAgentAvatarp->stopAllPhases();
static volatile bool reporting_started(false);
static volatile S32 report_sequence(0);
- LLSD msg = metricsData();
+ LLSD msg; // = metricsData();
msg["message"] = "ViewerAppearanceChangeMetrics";
msg["session_id"] = gAgentSessionID;
msg["agent_id"] = gAgentID;
@@ -2261,8 +2310,35 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics()
msg["initial"] = !reporting_started;
msg["break"] = false;
msg["duration"] = mTimeSinceLastRezMessage.getElapsedTimeF32();
- mTimeSinceLastRezMessage.reset();
-
+
+ // Status of our own rezzing.
+ msg["rez_status"] = LLVOAvatar::rezStatusToString(getRezzedStatus());
+
+ // Status of all nearby avs including ourself.
+ msg["nearby"] = LLSD::emptyArray();
+ std::vector<S32> rez_counts;
+ LLVOAvatar::getNearbyRezzedStats(rez_counts);
+ for (S32 rez_stat=0; rez_stat < rez_counts.size(); ++rez_stat)
+ {
+ std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat);
+ msg["nearby"][rez_status_name] = rez_counts[rez_stat];
+ }
+
+ // std::vector<std::string> bucket_fields("timer_name","agent_id","is_self","grid_x","grid_y","is_using_server_bake");
+ std::vector<std::string> by_fields;
+ by_fields.push_back("timer_name");
+ by_fields.push_back("agent_id");
+ by_fields.push_back("completed");
+ by_fields.push_back("grid_x");
+ by_fields.push_back("grid_y");
+ by_fields.push_back("is_using_server_bake");
+ by_fields.push_back("is_self");
+ by_fields.push_back("cbv");
+ LLSD summary = summarize_by_buckets(mPendingTimerRecords, by_fields, std::string("elapsed"));
+ msg["timers"] = summary;
+
+ mPendingTimerRecords.clear();
+
// Update sequence number
if (S32_MAX == ++report_sequence)
report_sequence = 0;
@@ -2282,6 +2358,7 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics()
new ViewerAppearanceChangeMetricsResponder(report_sequence,
report_sequence,
reporting_started));
+ mTimeSinceLastRezMessage.reset();
}
}
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 857c482f93..04b0fb760c 100755
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -382,6 +382,9 @@ public:
LLTimer mTimeSinceLastRezMessage;
bool updateAvatarRezMetrics(bool force_send);
+
+ std::vector<LLSD> mPendingTimerRecords;
+ void addMetricsTimerRecord(const LLSD& record);
void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); }
void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); }
@@ -398,8 +401,7 @@ public:
void dumpAllTextures() const;
const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer
const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD
- LLSD metricsData();
- void sendAppearanceChangeMetrics(); // send data associated with completing a change.
+ void sendViewerAppearanceChangeMetrics(); // send data associated with completing a change.
private:
LLFrameTimer mDebugSelfLoadTimer;
F32 mDebugTimeWearablesLoaded;