summaryrefslogtreecommitdiff
path: root/indra/llfilesystem/lldiskcache.cpp
diff options
context:
space:
mode:
authorCallum Prentice <callum@gmail.com>2020-10-07 16:03:28 -0700
committerCallum Prentice <callum@gmail.com>2020-10-07 16:03:28 -0700
commit5fdc4a1fb4a1788b20ca7a2e7764fd1391c35785 (patch)
tree00c85045c03ae4beb4d4c0ea62e5b39286bdef98 /indra/llfilesystem/lldiskcache.cpp
parent08dfc0836fb12855d0c07d811e2909400d5b74f3 (diff)
Add in some cache stats for the about box
Diffstat (limited to 'indra/llfilesystem/lldiskcache.cpp')
-rw-r--r--indra/llfilesystem/lldiskcache.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp
index 4b82cf3cce..455e27221e 100644
--- a/indra/llfilesystem/lldiskcache.cpp
+++ b/indra/llfilesystem/lldiskcache.cpp
@@ -187,8 +187,6 @@ const std::string LLDiskCache::metaDataToFilepath(const std::string id,
file_path << assetTypeToString(at);
file_path << ".asset";
- LL_INFOS() << "filepath.str() = " << file_path.str() << LL_ENDL;
-
return file_path.str();
}
@@ -204,6 +202,24 @@ void LLDiskCache::updateFileAccessTime(const std::string file_path)
}
/**
+ *
+ */
+const std::string LLDiskCache::getCacheInfo()
+{
+ std::ostringstream cache_info;
+
+ F32 max_in_mb = (F32)mMaxSizeBytes / (1024.0 * 1024.0);
+ F32 percent_used = ((F32)dirFileSize(mCacheDir) / (F32)mMaxSizeBytes) * 100.0;
+
+ cache_info << std::fixed;
+ cache_info << std::setprecision(1);
+ cache_info << "Max size " << max_in_mb << " MB ";
+ cache_info << "(" << percent_used << "% used)";
+
+ return cache_info.str();
+}
+
+/**
* Clear the cache by removing all the files in the cache directory
* individually. It's important to maintain control of which directory
* if passed in and not let the user inadvertently (or maliciously) set