summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2017-03-10 11:29:48 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2017-03-10 11:29:48 -0500
commite9c786ec6060da836bf6aa49f0e443f41f41a2c0 (patch)
tree6b5edce6ba9ac2330e3f39c8d7ced251971547e7 /indra
parentf028290c9e1afd241944ad63e8ce34af755a2233 (diff)
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.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llappviewer.cpp11
-rw-r--r--indra/newview/lltexturefetch.cpp52
-rw-r--r--indra/newview/lltexturefetch.h2
-rw-r--r--indra/newview/llviewerassetstats.cpp6
4 files changed, 28 insertions, 43 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 5eb82a2d0b..b138631f92 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -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
{
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 9469a3c373..6468991c79 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -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);
-
- LLSD sd;
- LLParamSDParser parser;
- parser.writeSD(sd, stats);
+ 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);
+
+ 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;
diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h
index 072e6a3307..cfa312ccd9 100644
--- a/indra/newview/lltexturefetch.h
+++ b/indra/newview/lltexturefetch.h
@@ -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();
diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp
index a9e0ba7b5d..14e05fd440 100644
--- a/indra/newview/llviewerassetstats.cpp
+++ b/indra/newview/llviewerassetstats.cpp
@@ -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);
}