From 86449a0ac4cb1432a55c17bfabe83c4c42c096a8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 14 Feb 2017 09:31:08 -0500 Subject: SL-409 - debug setting to enable/disable use of ViewerAsset cap by asset type. Temporary construction until UDP path goes away. --- indra/llcommon/llassettype.cpp | 93 +++++++++++++++++++++++++++++++++++++++++- indra/llcommon/llassettype.h | 5 +++ 2 files changed, 97 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 4304db36be..6ecc2ec740 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -31,6 +31,9 @@ #include "llmemory.h" #include "llsingleton.h" +#include +#include + ///---------------------------------------------------------------------------- /// Class LLAssetType ///---------------------------------------------------------------------------- @@ -48,7 +51,8 @@ struct AssetEntry : public LLDictionaryEntry mHumanName(human_name), mCanLink(can_link), mCanFetch(can_fetch), - mCanKnow(can_know) + mCanKnow(can_know), + mFetchWithVACap(false) { llassert(strlen(mTypeName) <= 8); } @@ -58,6 +62,7 @@ struct AssetEntry : public LLDictionaryEntry bool mCanLink; bool mCanFetch; bool mCanKnow; + bool mFetchWithVACap; }; class LLAssetDictionary : public LLSingleton, @@ -251,3 +256,89 @@ bool LLAssetType::lookupIsAssetIDKnowable(EType asset_type) } return false; } + +// static +bool LLAssetType::lookupFetchWithVACap(EType asset_type) +{ + LLAssetDictionary *dict = LLAssetDictionary::getInstance(); + const AssetEntry *entry = dict->lookup(asset_type); + if (entry) + { + return entry->mFetchWithVACap; + } + return false; +} + +// FIXME asset-http yank all this after asset-http becomes universal +void LLAssetType::setFetchWithVACapTypeString(const std::string& type_string) +{ + LLAssetDictionary *dict = LLAssetDictionary::getInstance(); + if (type_string=="none") + { + for (LLAssetDictionary::iterator iter = dict->begin(); + iter != dict->end(); + iter++) + { + AssetEntry *entry = iter->second; + entry->mFetchWithVACap = false; + } + } + else if (type_string=="all") + { + for (LLAssetDictionary::iterator iter = dict->begin(); + iter != dict->end(); + iter++) + { + AssetEntry *entry = iter->second; + entry->mFetchWithVACap = true; + } + } + else + { + for (LLAssetDictionary::iterator iter = dict->begin(); + iter != dict->end(); + iter++) + { + AssetEntry *entry = iter->second; + if (entry->mTypeName==type_string) + { + entry->mFetchWithVACap = true; + } + } + } +} + +// FIXME asset-http yank all this after asset-http becomes universal +void LLAssetType::setFetchWithVACapConfigString(const std::string& config_string) +{ + // Clear any currently enabled types + LLAssetType::setFetchWithVACapTypeString("none"); + + // Enable all types specified in the config string. + std::set type_names_for_va_cap; + boost::split(type_names_for_va_cap, config_string, boost::is_any_of(" :,")); + for (std::set::const_iterator it = type_names_for_va_cap.begin(); + it != type_names_for_va_cap.end(); ++it) + { + const std::string& type_string = *it; + LLAssetType::setFetchWithVACapTypeString(type_string); + } + + LLAssetDictionary *dict = LLAssetDictionary::getInstance(); + bool any_found = false; + for (LLAssetDictionary::iterator iter = dict->begin(); + iter != dict->end(); + iter++) + { + AssetEntry *entry = iter->second; + if (entry->mFetchWithVACap) + { + any_found = true; + LL_WARNS() << "Fetch with ViewerAsset cap enabled for " << entry->mTypeName << LL_ENDL; + } + } + if (!any_found) + { + LL_WARNS() << "Fetch with ViewerAsset cap disabled for all types" << LL_ENDL; + } +} diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 3a4b5dad18..e06ebc2a35 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -152,6 +152,11 @@ public: static bool lookupIsAssetFetchByIDAllowed(EType asset_type); // the asset allows direct download static bool lookupIsAssetIDKnowable(EType asset_type); // asset data can be known by the viewer + + static bool lookupFetchWithVACap(EType asset_type); // asset data is fetched via http using ViewerAsset cap. + + static void setFetchWithVACapTypeString(const std::string& type_string); + static void setFetchWithVACapConfigString(const std::string& config_string); static const std::string& badLookup(); // error string when a lookup fails -- cgit v1.3 From f70abb4ad628b19c993a22c7e86d350395555fcf Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 3 Mar 2017 15:14:09 -0500 Subject: SL-409 - added tracking for bytes fetched to viewer assets metrics (does not currently work for textures) --- indra/llcommon/llerror.cpp | 2 +- indra/llmessage/llassetstorage.cpp | 17 ++++++++++++++++- indra/llmessage/llassetstorage.h | 1 + indra/newview/llviewerassetstats.cpp | 10 +++++++--- indra/newview/llviewerassetstats.h | 9 +++++---- indra/newview/llviewerassetstorage.cpp | 7 +++++-- indra/newview/llviewerassetstorage.h | 5 ++++- scripts/metrics/viewer_asset_logs.py | 8 ++++++-- 8 files changed, 45 insertions(+), 14 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index e6407ecf22..9c49f7eff4 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -572,7 +572,7 @@ namespace LLError mFunctionString += std::string(mFunction) + ":"; for (size_t i = 0; i < mTagCount; i++) { - mTagString += std::string("#") + mTags[i] + ((i == mTagCount - 1) ? "" : ","); + mTagString += std::string("#") + mTags[i] + ((i == mTagCount - 1) ? " " : ","); } } diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 7bf886ef26..ab6fc69413 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -195,7 +195,8 @@ LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type mInfoCallback( NULL ), mIsLocal(FALSE), mIsUserWaiting(FALSE), - mTimeout(LL_ASSET_STORAGE_TIMEOUT) + mTimeout(LL_ASSET_STORAGE_TIMEOUT), + mBytesFetched(0) { } @@ -641,6 +642,20 @@ void LLAssetStorage::downloadCompleteCallback( result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE; vfile.remove(); } + else + { +#if 1 + for (request_list_t::iterator iter = gAssetStorage->mPendingDownloads.begin(); + iter != gAssetStorage->mPendingDownloads.end(); ++iter ) + { + LLAssetRequest* dlreq = *iter; + if ((dlreq->getUUID() == file_id) && (dlreq->getType()== file_type)) + { + dlreq->mBytesFetched = vfile.getSize(); + } + } +#endif + } } removeAndCallbackPendingDownloads(file_id, file_type, callback_id, callback_type, ext_status, result); diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index 2ec8ac31b4..d6b4fa0c7b 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -138,6 +138,7 @@ public: BOOL mIsUserWaiting; // We don't want to try forever if a user is waiting for a result. F64Seconds mTimeout; // Amount of time before timing out. LLUUID mRequestingAgentID; // Only valid for uploads from an agent + F64 mBytesFetched; virtual LLSD getTerseDetails() const; virtual LLSD getFullDetails() const; diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index d47f73ccce..a9e0ba7b5d 100644 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -168,6 +168,7 @@ namespace LLViewerAssetStatsFF static LLTrace::DCCountStatHandle<> sEnqueued[EVACCount]; static LLTrace::DCCountStatHandle<> sDequeued[EVACCount]; + static LLTrace::DCEventStatHandle<> sBytesFetched[EVACCount]; static LLTrace::DCEventStatHandle sResponse[EVACCount]; } @@ -277,7 +278,8 @@ void LLViewerAssetStats::getStat(LLTrace::Recording& rec, T& req, LLViewerAssetS .resp_count(rec.getSampleCount(sResponse[cat])) .resp_min(rec.getMin(sResponse[cat]).value()) .resp_max(rec.getMax(sResponse[cat]).value()) - .resp_mean(rec.getMean(sResponse[cat]).value()); + .resp_mean(rec.getMean(sResponse[cat]).value()) + .resp_mean_bytes(rec.getMean(sBytesFetched[cat])); } } @@ -370,11 +372,12 @@ void record_dequeue(LLViewerAssetType::EType at, bool with_http, bool is_temp) add(sDequeued[int(eac)], 1); } -void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration) +void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration, F64 bytes) { const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp)); record(sResponse[int(eac)], F64Microseconds(duration)); + record(sBytesFetched[int(eac)], bytes); } void init() @@ -403,7 +406,8 @@ LLViewerAssetStats::AssetRequestType::AssetRequestType() resp_count("resp_count"), resp_min("resp_min"), resp_max("resp_max"), - resp_mean("resp_mean") + resp_mean("resp_mean"), + resp_mean_bytes("resp_mean_bytes") {} LLViewerAssetStats::FPSStats::FPSStats() diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h index a2545c0bad..718c284224 100644 --- a/indra/newview/llviewerassetstats.h +++ b/indra/newview/llviewerassetstats.h @@ -118,11 +118,12 @@ public: struct AssetRequestType : public LLInitParam::Block { Mandatory enqueued, - dequeued, - resp_count; + dequeued, + resp_count; Mandatory resp_min, resp_max, - resp_mean; + resp_mean, + resp_mean_bytes; AssetRequestType(); }; @@ -272,7 +273,7 @@ void record_enqueue(LLViewerAssetType::EType at, bool with_http, bool is_temp); void record_dequeue(LLViewerAssetType::EType at, bool with_http, bool is_temp); void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp, - LLViewerAssetStats::duration_t duration); + LLViewerAssetStats::duration_t duration, F64 bytes=0); void record_avatar_stats(); diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 85150bf7fa..fa3567620c 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -82,7 +82,8 @@ protected: LLViewerAssetStatsFF::record_dequeue(mType, mWithHTTP, false); LLViewerAssetStatsFF::record_response(mType, mWithHTTP, false, (LLViewerAssetStatsFF::get_timestamp() - - mMetricsStartTime)); + - mMetricsStartTime), + mBytesFetched); mMetricsStartTime = (U32Seconds)0; } } @@ -458,12 +459,13 @@ void LLViewerAssetStorage::queueRequestHttp( LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro", - boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, uuid, atype, callback, user_data)); + boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data)); } } } void LLViewerAssetStorage::assetRequestCoro( + LLViewerAssetRequest *req, const LLUUID& uuid, LLAssetType::EType atype, LLGetAssetCallback callback, @@ -506,6 +508,7 @@ void LLViewerAssetStorage::assetRequestCoro( temp_id.generate(); LLVFile vf(gAssetStorage->mVFS, temp_id, atype, LLVFile::WRITE); vf.setMaxSize(size); + req->mBytesFetched = size; if (!vf.write(raw.data(),size)) { // TODO asset-http: handle error diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index d28a8a276f..3ca8112601 100644 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -31,6 +31,8 @@ class LLVFile; +class LLViewerAssetRequest; + class LLViewerAssetStorage : public LLAssetStorage { public: @@ -85,7 +87,8 @@ protected: BOOL duplicate, BOOL is_priority); - void assetRequestCoro(const LLUUID& uuid, + void assetRequestCoro(LLViewerAssetRequest *req, + const LLUUID& uuid, LLAssetType::EType atype, void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), void *user_data); diff --git a/scripts/metrics/viewer_asset_logs.py b/scripts/metrics/viewer_asset_logs.py index 47f0658138..8e46ca4707 100644 --- a/scripts/metrics/viewer_asset_logs.py +++ b/scripts/metrics/viewer_asset_logs.py @@ -72,6 +72,7 @@ def update_stats(stats,rec): #print "field",field,"count",type_stats["count"] if (newcount>0): type_stats["sum"] = type_stats.get("sum",0) + val["resp_count"] * val["resp_mean"] + type_stats["sum_bytes"] = type_stats.get("sum_bytes",0) + val["resp_count"] * val.get("resp_mean_bytes",0) type_stats["enqueued"] = type_stats.get("enqueued",0) + val["enqueued"] type_stats["dequeued"] = type_stats.get("dequeued",0) + val["dequeued"] @@ -92,7 +93,10 @@ if __name__ == "__main__": update_stats(stats,rec) - for key, val in stats.iteritems(): + for key in sorted(stats.keys()): + val = stats[key] if val["count"] > 0: - print "key",key,"count",val["count"],"mean",val["sum"]/val["count"],"enqueued",val["enqueued"],"dequeued",val["dequeued"] + print key,"count",val["count"],"mean_time",val["sum"]/val["count"],"mean_bytes",val["sum_bytes"]/val["count"],"enqueued",val["enqueued"],"dequeued",val["dequeued"] + else: + print key,"count",val["count"],"enqueued",val["enqueued"],"dequeued",val["dequeued"] -- cgit v1.3 From 17384ce6c43a9e07031d7deeea4ec9bbee76199c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 20 Mar 2017 16:04:02 -0400 Subject: MAINT-7195 work (can't repro), removed UDP fetching path, handle more possible timing issues while connecting to region --- indra/llcommon/llassettype.cpp | 90 +----------------- indra/llcommon/llassettype.h | 5 - indra/newview/app_settings/settings.xml | 12 --- indra/newview/llstartup.cpp | 10 -- indra/newview/llviewerassetstorage.cpp | 162 ++++++++++++-------------------- indra/newview/llviewerassetstorage.h | 12 +-- indra/newview/llviewercontrol.cpp | 8 -- 7 files changed, 65 insertions(+), 234 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 6ecc2ec740..5e8129b9b2 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -51,8 +51,7 @@ struct AssetEntry : public LLDictionaryEntry mHumanName(human_name), mCanLink(can_link), mCanFetch(can_fetch), - mCanKnow(can_know), - mFetchWithVACap(false) + mCanKnow(can_know) { llassert(strlen(mTypeName) <= 8); } @@ -62,7 +61,6 @@ struct AssetEntry : public LLDictionaryEntry bool mCanLink; bool mCanFetch; bool mCanKnow; - bool mFetchWithVACap; }; class LLAssetDictionary : public LLSingleton, @@ -256,89 +254,3 @@ bool LLAssetType::lookupIsAssetIDKnowable(EType asset_type) } return false; } - -// static -bool LLAssetType::lookupFetchWithVACap(EType asset_type) -{ - LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - const AssetEntry *entry = dict->lookup(asset_type); - if (entry) - { - return entry->mFetchWithVACap; - } - return false; -} - -// FIXME asset-http yank all this after asset-http becomes universal -void LLAssetType::setFetchWithVACapTypeString(const std::string& type_string) -{ - LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - if (type_string=="none") - { - for (LLAssetDictionary::iterator iter = dict->begin(); - iter != dict->end(); - iter++) - { - AssetEntry *entry = iter->second; - entry->mFetchWithVACap = false; - } - } - else if (type_string=="all") - { - for (LLAssetDictionary::iterator iter = dict->begin(); - iter != dict->end(); - iter++) - { - AssetEntry *entry = iter->second; - entry->mFetchWithVACap = true; - } - } - else - { - for (LLAssetDictionary::iterator iter = dict->begin(); - iter != dict->end(); - iter++) - { - AssetEntry *entry = iter->second; - if (entry->mTypeName==type_string) - { - entry->mFetchWithVACap = true; - } - } - } -} - -// FIXME asset-http yank all this after asset-http becomes universal -void LLAssetType::setFetchWithVACapConfigString(const std::string& config_string) -{ - // Clear any currently enabled types - LLAssetType::setFetchWithVACapTypeString("none"); - - // Enable all types specified in the config string. - std::set type_names_for_va_cap; - boost::split(type_names_for_va_cap, config_string, boost::is_any_of(" :,")); - for (std::set::const_iterator it = type_names_for_va_cap.begin(); - it != type_names_for_va_cap.end(); ++it) - { - const std::string& type_string = *it; - LLAssetType::setFetchWithVACapTypeString(type_string); - } - - LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - bool any_found = false; - for (LLAssetDictionary::iterator iter = dict->begin(); - iter != dict->end(); - iter++) - { - AssetEntry *entry = iter->second; - if (entry->mFetchWithVACap) - { - any_found = true; - LL_WARNS() << "Fetch with ViewerAsset cap enabled for " << entry->mTypeName << LL_ENDL; - } - } - if (!any_found) - { - LL_WARNS() << "Fetch with ViewerAsset cap disabled for all types" << LL_ENDL; - } -} diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index e06ebc2a35..b849be9f16 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -153,11 +153,6 @@ public: static bool lookupIsAssetFetchByIDAllowed(EType asset_type); // the asset allows direct download static bool lookupIsAssetIDKnowable(EType asset_type); // asset data can be known by the viewer - static bool lookupFetchWithVACap(EType asset_type); // asset data is fetched via http using ViewerAsset cap. - - static void setFetchWithVACapTypeString(const std::string& type_string); - static void setFetchWithVACapConfigString(const std::string& config_string); - static const std::string& badLookup(); // error string when a lookup fails protected: diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9b26053fb5..717deba8c7 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15808,18 +15808,6 @@ 0 - ViewerAssetHttpTypes - - Comment - Use the ViewerAsset cap and HTTP pipeline for fetching assets of the listed type names. "none" and "all" are recognized as a special values. - Persist - 1 - Type - String - Value - all - - SimulateFBOFailure Comment diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 0ef337b6c4..b762b2ae1c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -312,16 +312,6 @@ void set_flags_and_update_appearance() // true when all initialization done. bool idle_startup() { - // FIXME asset-http - this configuration stuff is temporary - // construction; once it is always on for certain types - // we can remove the setting. - static bool va_types_initialized = false; - if (!va_types_initialized) - { - va_types_initialized = true; - LLAssetType::setFetchWithVACapConfigString(gSavedSettings.getString("ViewerAssetHttpTypes")); - } - const F32 PRECACHING_DELAY = gSavedSettings.getF32("PrecachingDelay"); static LLTimer timeout; diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 496fbbecff..cb60337a7f 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -42,6 +42,7 @@ #include "llcoros.h" #include "lleventcoro.h" #include "llsdutil.h" +#include "llworld.h" ///---------------------------------------------------------------------------- /// LLViewerAssetRequest @@ -350,17 +351,10 @@ void LLViewerAssetStorage::_queueDataRequest( BOOL duplicate, BOOL is_priority) { - if (LLAssetType::lookupFetchWithVACap(atype)) - { - queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority); - } - else - { - queueRequestUDP(uuid, atype, callback, user_data, duplicate, is_priority); - } + queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority); } -void LLViewerAssetStorage::queueRequestUDP( +void LLViewerAssetStorage::queueRequestHttp( const LLUUID& uuid, LLAssetType::EType atype, LLGetAssetCallback callback, @@ -368,116 +362,84 @@ void LLViewerAssetStorage::queueRequestUDP( BOOL duplicate, BOOL is_priority) { - LL_DEBUGS("ViewerAsset") << "Request asset via UDP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; + LL_DEBUGS("ViewerAsset") << "Request asset via HTTP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; - if (mUpstreamHost.isOk()) + bool with_http = true; + LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http); + req->mDownCallback = callback; + req->mUserData = user_data; + req->mIsPriority = is_priority; + if (!duplicate) { - // stash the callback info so we can find it after we get the response message - bool with_http = false; - LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http); - req->mDownCallback = callback; - req->mUserData = user_data; - req->mIsPriority = is_priority; - if (!duplicate) - { - // Only collect metrics for non-duplicate requests. Others - // are piggy-backing and will artificially lower averages. - req->mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); - } - - mPendingDownloads.push_back(req); - - if (!duplicate) - { - // send request message to our upstream data provider - // Create a new asset transfer. - LLTransferSourceParamsAsset spa; - spa.setAsset(uuid, atype); - - // Set our destination file, and the completion callback. - LLTransferTargetParamsVFile tpvf; - tpvf.setAsset(uuid, atype); - tpvf.setCallback(downloadCompleteCallback, *req); - - LL_DEBUGS("AssetStorage") << "Starting transfer for " << uuid << LL_ENDL; - LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET); - ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f)); - - bool with_http = false; - bool is_temp = false; - LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); - } + // Only collect metrics for non-duplicate requests. Others + // are piggy-backing and will artificially lower averages. + req->mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); } - else + mPendingDownloads.push_back(req); + + // This is the same as the current UDP logic - don't re-request a duplicate. + if (!duplicate) { - // uh-oh, we shouldn't have gotten here - LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL; - if (callback) - { - callback(mVFS, uuid, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM); - } + bool with_http = true; + bool is_temp = false; + LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); + + LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro", + boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data)); } } -void LLViewerAssetStorage::queueRequestHttp( +void LLViewerAssetStorage::capsRecvForRegion(const LLUUID& region_id, std::string pumpname) +{ + LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(region_id); + mViewerAssetUrl = regionp->getViewerAssetUrl(); + + LLEventPumps::instance().obtain(pumpname).post(LLSD()); +} + +void LLViewerAssetStorage::assetRequestCoro( + LLViewerAssetRequest *req, const LLUUID& uuid, LLAssetType::EType atype, LLGetAssetCallback callback, - void *user_data, - BOOL duplicate, - BOOL is_priority) + void *user_data) { - LL_DEBUGS("ViewerAsset") << "Request asset via HTTP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; + S32 result_code = LL_ERR_NOERR; + LLExtStat ext_status = LL_EXSTAT_NONE; + if (!gAgent.getRegion()) { - LL_WARNS() << "No region, fetch fails" << LL_ENDL; + LL_WARNS_ONCE() << "Asset request fails: no region set" << LL_ENDL; + result_code = LL_ERR_ASSET_REQUEST_FAILED; + ext_status = LL_EXSTAT_NONE; + removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); return; } - std::string cap_url = gAgent.getRegion()->getCapability("ViewerAsset"); - if (cap_url.empty()) + else if (!gAgent.getRegion()->capabilitiesReceived()) { - LL_WARNS() << "No ViewerAsset cap found, fetch fails" << LL_ENDL; - // TODO asset-http: handle waiting for caps? Other failure mechanism? - return; + LLEventStream capsRecv("waitForCaps", true); + + gAgent.getRegion()->setCapabilitiesReceivedCallback( + boost::bind(&LLViewerAssetStorage::capsRecvForRegion, this, _1, capsRecv.getName())); + + llcoro::suspendUntilEventOn(capsRecv); } else { - LL_DEBUGS("ViewerAsset") << "Will fetch via ViewerAsset cap " << cap_url << LL_ENDL; - - bool with_http = true; - LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http); - req->mDownCallback = callback; - req->mUserData = user_data; - req->mIsPriority = is_priority; - if (!duplicate) - { - // Only collect metrics for non-duplicate requests. Others - // are piggy-backing and will artificially lower averages. - req->mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); - } - mPendingDownloads.push_back(req); - - // This is the same as the current UDP logic - don't re-request a duplicate. - if (!duplicate) + if (mViewerAssetUrl.empty()) { - bool with_http = true; - bool is_temp = false; - LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); - - LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro", - boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data)); + mViewerAssetUrl = gAgent.getRegion()->getViewerAssetUrl(); } } -} - -void LLViewerAssetStorage::assetRequestCoro( - LLViewerAssetRequest *req, - const LLUUID& uuid, - LLAssetType::EType atype, - LLGetAssetCallback callback, - void *user_data) -{ - std::string url = getAssetURL(uuid,atype); + if (mViewerAssetUrl.empty()) + { + LL_WARNS_ONCE() << "asset request fails: caps received but no viewer asset cap found" << LL_ENDL; + result_code = LL_ERR_ASSET_REQUEST_FAILED; + ext_status = LL_EXSTAT_NONE; + removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); + return; + } + std::string url = getAssetURL(mViewerAssetUrl, uuid,atype); LL_DEBUGS("ViewerAsset") << "request url: " << url << LL_ENDL; LLCore::HttpRequest::policy_t httpPolicy(LLAppCoreHttp::AP_TEXTURE); @@ -488,9 +450,6 @@ void LLViewerAssetStorage::assetRequestCoro( LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts); - S32 result_code = LL_ERR_NOERR; - LLExtStat ext_status = LL_EXSTAT_NONE; - LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) @@ -542,9 +501,8 @@ void LLViewerAssetStorage::assetRequestCoro( removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); } -std::string LLViewerAssetStorage::getAssetURL(const LLUUID& uuid, LLAssetType::EType atype) +std::string LLViewerAssetStorage::getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype) { - std::string cap_url = gAgent.getRegion()->getViewerAssetUrl(); std::string type_name = LLAssetType::lookup(atype); std::string url = cap_url + "/?" + type_name + "_id=" + uuid.asString(); return url; diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index 3ca8112601..2f3eaa15a7 100644 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -73,13 +73,6 @@ protected: BOOL duplicate, BOOL is_priority); - void queueRequestUDP(const LLUUID& uuid, - LLAssetType::EType type, - void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), - void *user_data, - BOOL duplicate, - BOOL is_priority); - void queueRequestHttp(const LLUUID& uuid, LLAssetType::EType type, void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), @@ -87,14 +80,17 @@ protected: BOOL duplicate, BOOL is_priority); + void capsRecvForRegion(const LLUUID& region_id, std::string pumpname); + void assetRequestCoro(LLViewerAssetRequest *req, const LLUUID& uuid, LLAssetType::EType atype, void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), void *user_data); - std::string getAssetURL(const LLUUID& uuid, LLAssetType::EType atype); + std::string getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype); + std::string mViewerAssetUrl; }; #endif diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index c0a87adca5..7c1921b143 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -127,13 +127,6 @@ static bool handleDebugAvatarJointsChanged(const LLSD& newvalue) return true; } -static bool handleViewerAssetHttpTypesChanged(const LLSD& newvalue) -{ - std::string new_string = newvalue.asString(); - LLAssetType::setFetchWithVACapConfigString(new_string); - return true; -} - static bool handleSetShaderChanged(const LLSD& newvalue) { // changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache @@ -757,7 +750,6 @@ void settings_setup_listeners() gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("LoginLocation")->getSignal()->connect(boost::bind(&handleLoginLocationChanged)); gSavedSettings.getControl("DebugAvatarJoints")->getCommitSignal()->connect(boost::bind(&handleDebugAvatarJointsChanged, _2)); - gSavedSettings.getControl("ViewerAssetHttpTypes")->getCommitSignal()->connect(boost::bind(&handleViewerAssetHttpTypesChanged, _2)); } #if TEST_CACHED_CONTROL -- cgit v1.3 From b7b8d6e1aedeac1dfdfcc9200024bbcc8e2dacae Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Apr 2017 12:39:14 -0400 Subject: MAINT-7343 - added periodic logging of state of the asset store. --- indra/llcommon/llassettype.cpp | 3 -- indra/llmessage/llassetstorage.h | 2 ++ indra/newview/app_settings/settings.xml | 11 +++++++ indra/newview/lltexturefetch.cpp | 5 +++- indra/newview/llviewerassetstorage.cpp | 51 +++++++++++++++++++++++++++++++-- indra/newview/llviewerassetstorage.h | 8 ++++++ indra/newview/llviewerdisplay.cpp | 7 +++++ 7 files changed, 81 insertions(+), 6 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 5e8129b9b2..4304db36be 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -31,9 +31,6 @@ #include "llmemory.h" #include "llsingleton.h" -#include -#include - ///---------------------------------------------------------------------------- /// Class LLAssetType ///---------------------------------------------------------------------------- diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index d6b4fa0c7b..33b88473b9 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -253,6 +253,8 @@ public: bool user_waiting= false, F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) = 0; + virtual void logAssetStorageInfo() = 0; + void checkForTimeouts(); void getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id, diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 097a9ac7b9..d2d629339d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14639,6 +14639,17 @@ Value 0 + AssetStorageLogFrequency + + Comment + Seconds between display of AssetStorage info in log (0 for never) + Persist + 1 + Type + F32 + Value + 60.0 + LogWearableAssetSave Comment diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 09d7c2eb2d..7245a70962 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1428,7 +1428,10 @@ bool LLTextureFetchWorker::doWork(S32 param) F64 byte_count = 0; for (S32 i=mFirstPacket; i<=mLastPacket; i++) { - byte_count += mPackets[i]->mSize; + if (mPackets[i]) + { + byte_count += mPackets[i]->mSize; + } } LL_DEBUGS(LOG_TXT) << mID << ": Loaded from Sim. Bytes: " << mFormattedImage->getDataSize() << LL_ENDL; diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 6523b89d7f..9918d226c2 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -99,17 +99,30 @@ public: /// LLViewerAssetStorage ///---------------------------------------------------------------------------- +// Unused? LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, LLVFS *static_vfs, const LLHost &upstream_host) - : LLAssetStorage(msg, xfer, vfs, static_vfs, upstream_host) + : LLAssetStorage(msg, xfer, vfs, static_vfs, upstream_host), + mAssetCoroCount(0), + mCountRequests(0), + mCountStarted(0), + mCountCompleted(0), + mCountSucceeded(0), + mTotalBytesFetched(0) { } LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, LLVFS *static_vfs) - : LLAssetStorage(msg, xfer, vfs, static_vfs) + : LLAssetStorage(msg, xfer, vfs, static_vfs), + mAssetCoroCount(0), + mCountRequests(0), + mCountStarted(0), + mCountCompleted(0), + mCountSucceeded(0), + mTotalBytesFetched(0) { } @@ -351,6 +364,7 @@ void LLViewerAssetStorage::_queueDataRequest( BOOL duplicate, BOOL is_priority) { + mCountRequests++; queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority); } @@ -404,6 +418,20 @@ void LLViewerAssetStorage::capsRecvForRegion(const LLUUID& region_id, std::strin LLEventPumps::instance().obtain(pumpname).post(LLSD()); } +struct LLScopedIncrement +{ + LLScopedIncrement(S32& counter): + mCounter(counter) + { + ++mCounter; + } + ~LLScopedIncrement() + { + --mCounter; + } + S32& mCounter; +}; + void LLViewerAssetStorage::assetRequestCoro( LLViewerAssetRequest *req, const LLUUID& uuid, @@ -411,6 +439,9 @@ void LLViewerAssetStorage::assetRequestCoro( LLGetAssetCallback callback, void *user_data) { + LLScopedIncrement coro_count_boost(mAssetCoroCount); + mCountStarted++; + S32 result_code = LL_ERR_NOERR; LLExtStat ext_status = LL_EXSTAT_NONE; @@ -463,6 +494,8 @@ void LLViewerAssetStorage::assetRequestCoro( // Bail out if result arrives after shutdown has been started. return; } + + mCountCompleted++; LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -481,6 +514,8 @@ void LLViewerAssetStorage::assetRequestCoro( S32 size = raw.size(); if (size > 0) { + mTotalBytesFetched += size; + // This create-then-rename flow is modeled on // LLTransferTargetVFile, which is what was used in the UDP // case. @@ -502,6 +537,7 @@ void LLViewerAssetStorage::assetRequestCoro( result_code = LL_ERR_ASSET_REQUEST_FAILED; ext_status = LL_EXSTAT_VFS_CORRUPT; } + mCountSucceeded++; } else { @@ -522,3 +558,14 @@ std::string LLViewerAssetStorage::getAssetURL(const std::string& cap_url, const std::string url = cap_url + "/?" + type_name + "_id=" + uuid.asString(); return url; } + +void LLViewerAssetStorage::logAssetStorageInfo() +{ + LLMemory::logMemoryInfo(true); + LL_INFOS("AssetStorage") << "Active coros " << mAssetCoroCount << LL_ENDL; + LL_INFOS("AssetStorage") << "mPendingDownloads size " << mPendingDownloads.size() << LL_ENDL; + LL_INFOS("AssetStorage") << "mCountStarted " << mCountStarted << LL_ENDL; + LL_INFOS("AssetStorage") << "mCountCompleted " << mCountCompleted << LL_ENDL; + LL_INFOS("AssetStorage") << "mCountSucceeded " << mCountSucceeded << LL_ENDL; + LL_INFOS("AssetStorage") << "mTotalBytesFetched " << mTotalBytesFetched << LL_ENDL; +} diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index 2f3eaa15a7..8a58241378 100644 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -90,7 +90,15 @@ protected: std::string getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype); + void logAssetStorageInfo(); + std::string mViewerAssetUrl; + S32 mAssetCoroCount; + S32 mCountRequests; + S32 mCountStarted; + S32 mCountCompleted; + S32 mCountSucceeded; + S64 mTotalBytesFetched; }; #endif diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index afa00e3e6e..bfa9fa03fa 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -106,6 +106,7 @@ const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f; U32 gRecentFrameCount = 0; // number of 'recent' frames LLFrameTimer gRecentFPSTime; LLFrameTimer gRecentMemoryTime; +LLFrameTimer gAssetStorageLogTime; // Rendering stuff void pre_show_depth_buffer(); @@ -226,6 +227,12 @@ void display_stats() LLMemory::logMemoryInfo(TRUE) ; gRecentMemoryTime.reset(); } + F32 asset_storage_log_freq = gSavedSettings.getF32("AssetStorageLogFrequency"); + if (asset_storage_log_freq > 0.f && gAssetStorageLogTime.getElapsedTimeF32() >= asset_storage_log_freq) + { + gAssetStorageLogTime.reset(); + gAssetStorage->logAssetStorageInfo(); + } } static LLTrace::BlockTimerStatHandle FTM_PICK("Picking"); -- cgit v1.3