diff options
Diffstat (limited to 'indra/newview/lltexturefetch.cpp')
-rw-r--r-- | indra/newview/lltexturefetch.cpp | 52 |
1 files changed, 21 insertions, 31 deletions
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; |