From 4c0ba5395f7d854f1a28fd7ff01671e51a203d40 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Tue, 9 Mar 2021 16:02:16 -0500 Subject: [PATCH] Improve information in about floater for texture and disk cache --- indra/llfilesystem/lldiskcache.cpp | 7 ++++--- indra/newview/llappviewer.cpp | 6 ++++++ indra/newview/skins/default/xui/en/strings.xml | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index 75e268309af..5993de532ba 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -198,10 +198,11 @@ const std::string LLDiskCache::metaDataToFilepath(const LLUUID& id, const std::string LLDiskCache::getCacheInfo() { - F32 max_in_mb = (F32)mMaxSizeBytes / (1024.0 * 1024.0); - F32 percent_used = ((F32)dirFileSize(sCacheDir) / (F32)mMaxSizeBytes) * 100.0; + uintmax_t cache_used_mb = dirFileSize(sCacheDir) / (1024U * 1024U); + uintmax_t max_in_mb = mMaxSizeBytes / (1024U * 1024U); + F64 percent_used = ((F64)cache_used_mb / (F64)max_in_mb) * 100.0; - return llformat("Max size %1.f MB (%.1f %% used)", max_in_mb, percent_used); + return llformat("%juMB / %juMB (%.1f%% used)", cache_used_mb, max_in_mb, percent_used); } void LLDiskCache::clearCache() diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 045c0c88489..f6cfd62d6f0 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3300,6 +3300,12 @@ LLSD LLAppViewer::getViewerInfo() const info["SERVER_RELEASE_NOTES_URL"] = mServerReleaseNotesURL; } + // populate field for the texture cache with some details + S64Bytes texture_cache_used = getTextureCache()->getUsage(); + S64Bytes texture_cache_max = getTextureCache()->getMaxUsage(); + F64 percent_used = ((F64)texture_cache_used.value() / (F64)texture_cache_max.value()) * 100.0; + info["TEXTURE_CACHE_INFO"] = llformat("%dMB / %dMB (%.1f%% used)", S32Megabytes(texture_cache_used).value(), S32Megabytes(texture_cache_max).value(), percent_used); + // populate field for new local disk cache with some details info["DISK_CACHE_INFO"] = LLDiskCache::getInstance()->getCacheInfo(); diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 30ab0427d62..d8b17da7667 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -60,6 +60,7 @@ LOD factor: [LOD_FACTOR] Render quality: [RENDER_QUALITY] Advanced Lighting Model: [GPU_SHADERS] Texture memory: [TEXTURE_MEMORY]MB +Texture cache: [TEXTURE_CACHE_INFO] Disk cache: [DISK_CACHE_INFO] </string> <string name="AboutOSXHiDPI"> -- GitLab