SL-409 - fixes for viewer asset metrics. Copy and/or assignment of Recording objects is failing, changed to create LLSD blob earlier and just copy that.

master
Brad Payne (Vir Linden) 2017-03-10 11:29:48 -05:00
parent f028290c9e
commit e9c786ec60
4 changed files with 27 additions and 42 deletions

View File

@ -5912,23 +5912,18 @@ void LLAppViewer::metricsSend(bool enable_reporting)
{
std::string caps_url = regionp->getCapability("ViewerMetrics");
LLSD sd = gViewerAssetStats->asLLSD(true);
if (gSavedSettings.getBOOL("QAModeMetrics"))
{
dump_sequential_xml("metric_asset_stats",gViewerAssetStats->asLLSD(true));
dump_sequential_xml("metric_asset_stats",sd);
}
// Make a copy of the main stats to send into another thread.
// Receiving thread takes ownership.
LLViewerAssetStats * main_stats(new LLViewerAssetStats(*gViewerAssetStats));
main_stats->stop();
// Send a report request into 'thread1' to get the rest of the data
// and provide some additional parameters while here.
LLAppViewer::sTextureFetch->commandSendMetrics(caps_url,
gAgentSessionID,
gAgentID,
main_stats);
main_stats = 0; // Ownership transferred
sd);
}
else
{

View File

@ -824,7 +824,7 @@ public:
TFReqSendMetrics(const std::string & caps_url,
const LLUUID & session_id,
const LLUUID & agent_id,
LLViewerAssetStats * main_stats);
LLSD& stats_sd);
TFReqSendMetrics & operator=(const TFReqSendMetrics &); // Not defined
virtual ~TFReqSendMetrics();
@ -835,7 +835,7 @@ public:
const std::string mCapsURL;
const LLUUID mSessionID;
const LLUUID mAgentID;
LLViewerAssetStats * mMainStats;
LLSD mStatsSD;
private:
LLCore::HttpHandler::ptr_t mHandler;
@ -3872,9 +3872,9 @@ void LLTextureFetch::commandSetRegion(U64 region_handle)
void LLTextureFetch::commandSendMetrics(const std::string & caps_url,
const LLUUID & session_id,
const LLUUID & agent_id,
LLViewerAssetStats * main_stats)
LLSD& stats_sd)
{
TFReqSendMetrics * req = new TFReqSendMetrics(caps_url, session_id, agent_id, main_stats);
TFReqSendMetrics * req = new TFReqSendMetrics(caps_url, session_id, agent_id, stats_sd);
cmdEnqueue(req);
}
@ -3983,22 +3983,20 @@ TFReqSetRegion::doWork(LLTextureFetch *)
}
TFReqSendMetrics::TFReqSendMetrics(const std::string & caps_url,
const LLUUID & session_id,
const LLUUID & agent_id,
LLViewerAssetStats * main_stats):
const LLUUID & session_id,
const LLUUID & agent_id,
LLSD& stats_sd):
LLTextureFetch::TFRequest(),
mCapsURL(caps_url),
mSessionID(session_id),
mAgentID(agent_id),
mMainStats(main_stats),
mStatsSD(stats_sd),
mHandler(new AssetReportHandler)
{}
TFReqSendMetrics::~TFReqSendMetrics()
{
delete mMainStats;
mMainStats = 0;
}
@ -4019,26 +4017,18 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
static volatile bool reporting_started(false);
static volatile S32 report_sequence(0);
// We've taken over ownership of the stats copy at this
// point. Get a working reference to it for merging here
// but leave it in 'this'. Destructor will rid us of it.
LLViewerAssetStats & main_stats = *mMainStats;
LLViewerAssetStats::AssetStats stats;
main_stats.getStats(stats, true);
//LLSD merged_llsd = main_stats.asLLSD();
// In mStatsSD, we have a copy we own of the LLSD representation
// of the asset stats. Add some additional fields and ship it off.
bool initial_report = !reporting_started;
stats.session_id = mSessionID;
stats.agent_id = mAgentID;
stats.message = "ViewerAssetMetrics";
stats.sequence = static_cast<bool>(report_sequence);
stats.initial = initial_report;
stats.break_ = static_cast<bool>(LLTextureFetch::svMetricsDataBreak);
mStatsSD["session_id"] = mSessionID;
mStatsSD["agent_id"] = mAgentID;
mStatsSD["message"] = "ViewerAssetMetrics";
mStatsSD["sequence"] = report_sequence;
mStatsSD["initial"] = initial_report;
mStatsSD["break"] = static_cast<bool>(LLTextureFetch::svMetricsDataBreak);
LLSD sd;
LLParamSDParser parser;
parser.writeSD(sd, stats);
LL_INFOS(LOG_TXT) << "ViewerAssetMetrics after fields added\n" << ll_pretty_print_sd(mStatsSD) << LL_ENDL;
// Update sequence number
if (S32_MAX == ++report_sequence)
@ -4049,7 +4039,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
// Limit the size of the stats report if necessary.
sd["truncated"] = truncate_viewer_metrics(10, sd);
mStatsSD["truncated"] = truncate_viewer_metrics(10, mStatsSD);
if (! mCapsURL.empty())
{
@ -4058,7 +4048,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
fetcher->getMetricsPolicyClass(),
report_priority,
mCapsURL,
sd,
mStatsSD,
LLCore::HttpOptions::ptr_t(),
fetcher->getMetricsHeaders(),
mHandler);
@ -4072,7 +4062,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
// In QA mode, Metrics submode, log the result for ease of testing
if (fetcher->isQAMode())
{
LL_INFOS(LOG_TXT) << ll_pretty_print_sd(sd) << LL_ENDL;
LL_INFOS(LOG_TXT) << "ViewerAssetMetrics as submitted\n" << ll_pretty_print_sd(mStatsSD) << LL_ENDL;
}
return true;

View File

@ -160,7 +160,7 @@ public:
void commandSendMetrics(const std::string & caps_url,
const LLUUID & session_id,
const LLUUID & agent_id,
LLViewerAssetStats * main_stats);
LLSD& stats_sd);
// Threads: T*
void commandDataBreak();

View File

@ -323,10 +323,10 @@ void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output)
grid_from_region_handle(it->first, &grid_x, &grid_y);
r .grid_x(grid_x)
.grid_y(grid_y)
.duration(F64Microseconds(rec.getDuration()).value());
.duration(F64Seconds(rec.getDuration()).value());
}
stats.duration(mCurRecording ? F64Microseconds(mCurRecording->getDuration()).value() : 0.0);
stats.duration(mCurRecording ? F64Seconds(mCurRecording->getDuration()).value() : 0.0);
}
LLSD LLViewerAssetStats::asLLSD(bool compact_output)
@ -376,7 +376,7 @@ void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp,
{
const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
record(sResponse[int(eac)], F64Microseconds(duration));
record(sResponse[int(eac)], F64Seconds(duration));
record(sBytesFetched[int(eac)], bytes);
}