FIRE-34977 - Reduce Sim crossing overhead causing pauses

The purge thread should be the only thread recalculating cache usage. This removes the directory scan from the critial path where it would occasionally trigger due to aligned timers (exacerbated by high rates of region crossing)
master
Beq 2025-05-19 18:12:25 +01:00
parent fdf75d8854
commit 0d25562014
5 changed files with 22 additions and 3 deletions

View File

@ -333,11 +333,21 @@ const std::string LLDiskCache::metaDataToFilepath(const LLUUID& id, LLAssetType:
const std::string LLDiskCache::getCacheInfo()
{
LL_PROFILE_ZONE_SCOPED; // <FS:Beq/> add some instrumentation
std::ostringstream cache_info;
F32 max_in_mb = (F32)mMaxSizeBytes / (1024.0f * 1024.0f);
F32 percent_used = ((F32)dirFileSize(sCacheDir) / (F32)mMaxSizeBytes) * 100.0f;
// <FS:Beq> stall prevention. We still need to make sure this initialised when called at startup.
F32 percent_used;
if (mStoredCacheSize > 0)
{
percent_used = ((F32)mStoredCacheSize / (F32)mMaxSizeBytes) * 100.0f;
}
else
{
percent_used = ((F32)dirFileSize(sCacheDir) / (F32)mMaxSizeBytes) * 100.0f;
}
// </FS:Beq>
cache_info << std::fixed;
cache_info << std::setprecision(1);
cache_info << "Max size " << max_in_mb << " MB ";

View File

@ -113,10 +113,11 @@ class LLMessageHandlerBridge : public LLHTTPNode
void LLMessageHandlerBridge::post(LLHTTPNode::ResponsePtr response,
const LLSD& context, const LLSD& input) const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
std::string name = context[CONTEXT_REQUEST][CONTEXT_WILDCARD]["message-name"];
char* namePtr = LLMessageStringTable::getInstance()->getString(name.c_str());
LL_DEBUGS() << "Setting mLastSender " << input["sender"].asString() << LL_ENDL;
LL_DEBUGS("Messaging") << "Setting mLastSender " << input["sender"].asString() << LL_ENDL;
gMessageSystem->mLastSender = LLHost(input["sender"].asString());
gMessageSystem->mPacketsIn += 1;
gMessageSystem->mLLSDMessageReader->setMessage(namePtr, input["body"]);
@ -2050,6 +2051,7 @@ void LLMessageSystem::dispatch(
const std::string& msg_name,
const LLSD& message)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
LLPointer<LLSimpleResponse> responsep = LLSimpleResponse::create();
dispatch(msg_name, message, responsep);
}
@ -2060,6 +2062,7 @@ void LLMessageSystem::dispatch(
const LLSD& message,
LLHTTPNode::ResponsePtr responsep)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
if ((gMessageSystem->mMessageTemplates.find
(LLMessageStringTable::getInstance()->getString(msg_name.c_str())) ==
gMessageSystem->mMessageTemplates.end()) &&

View File

@ -64,6 +64,7 @@ std::string BugSplatAttributes::to_xml_token(const std::string& input)
bool BugSplatAttributes::writeToFile(const std::string& file_path)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING;
std::lock_guard<std::mutex> lock(mMutex);
// Write to a temporary file first

View File

@ -3795,6 +3795,7 @@ bool LLAppViewer::waitForUpdater()
void LLAppViewer::writeDebugInfo(bool isStatic)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING; // <FS:Beq/> improve instrumentation
#if LL_WINDOWS && LL_BUGSPLAT
// <FS:Beq> Improve Bugsplat tracking by using attributes for certain static data items.
const LLSD& info = getViewerInfo();
@ -3823,6 +3824,7 @@ void LLAppViewer::writeDebugInfo(bool isStatic)
LLSD LLAppViewer::getViewerInfo() const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING; // <FS:Beq/> improve instrumentation
// The point of having one method build an LLSD info block and the other
// construct the user-visible About string is to ensure that the same info
// is available to a getInfo() caller as to the user opening
@ -4135,6 +4137,7 @@ LLSD LLAppViewer::getViewerInfo() const
// info["DISK_CACHE_INFO"] = LLDiskCache::getInstance()->getCacheInfo();
if (auto cache = LLDiskCache::getInstance(); cache)
{
LL_PROFILE_ZONE_NAMED("gvi-getCacheInfo"); // <FS:Beq/> improve instrumentation
info["DISK_CACHE_INFO"] = cache->getCacheInfo();
}
// </FS:Beq>

View File

@ -644,11 +644,13 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
// <FS:Beq> Use the Attributes API on Windows to enhance crash metadata
void LLAppViewerWin32::bugsplatAddStaticAttributes(const LLSD& info)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING;
#ifdef LL_BUGSPLAT
auto& bugSplatMap = BugSplatAttributes::instance();
static bool write_once_after_startup = false;
if (!write_once_after_startup )
{
LL_PROFILE_ZONE_NAMED("bs-st-att-once")
// Only write the attributes that are fixed once after we've started.
// note we might update them more than once and some/many may be empty during startup as we want to catch early crashes
// once we're started we can assume they don't change for this run.