Simple cache viewer: Separate texture and asset cache sizes

master
Ansariel 2021-05-06 12:02:31 +02:00
parent 44081af153
commit c51cab60d4
6 changed files with 81 additions and 8 deletions

View File

@ -143,6 +143,9 @@ class LLDiskCache :
*/
const std::string getCacheInfo();
// <FS:Ansariel> Better asset cache size control
void setMaxSiteBytes(uintmax_t size) { mMaxSizeBytes = size; }
private:
/**
* Utility function to gather the total size the files in a given

View File

@ -2933,7 +2933,7 @@
<key>DiskCachePercentOfTotal</key>
<map>
<key>Comment</key>
<string>The percent of total cache size (defined by CacheSize) to use for the disk cache</string>
<string>The percent of total cache size (defined by CacheSize) to use for the disk cache (UNUSED)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@ -2952,6 +2952,17 @@
<key>Value</key>
<string>cache</string>
</map>
<key>FSDiskCacheSize</key>
<map>
<key>Comment</key>
<string>Controls amount of hard drive space reserved for local asset caching in MB</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>2048</integer>
</map>
<key>CacheLocation</key>
<map>
<key>Comment</key>
@ -2988,7 +2999,7 @@
<key>CacheSize</key>
<map>
<key>Comment</key>
<string>Controls amount of hard drive space reserved for local file caching in MB</string>
<string>Controls amount of hard drive space reserved for local texture caching in MB</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>

View File

@ -4966,9 +4966,12 @@ bool LLAppViewer::initCache()
// note that the maximum size of this cache is defined as a percentage of the
// total cache size - the 'CacheSize' pref - for all caches.
const unsigned int cache_total_size_mb = gSavedSettings.getU32("CacheSize");
const double disk_cache_percent = gSavedSettings.getF32("DiskCachePercentOfTotal");
const unsigned int disk_cache_mb = cache_total_size_mb * disk_cache_percent / 100;
// <FS:Ansariel> Better asset cache size control
//const unsigned int cache_total_size_mb = gSavedSettings.getU32("CacheSize");
//const double disk_cache_percent = gSavedSettings.getF32("DiskCachePercentOfTotal");
//const unsigned int disk_cache_mb = cache_total_size_mb * disk_cache_percent / 100;
const unsigned int disk_cache_mb = gSavedSettings.getU32("FSDiskCacheSize");
// </FS:Ansariel>
// <FS:Ansariel> Fix integer overflow
//const unsigned int disk_cache_bytes = disk_cache_mb * 1024 * 1024;
const uintmax_t disk_cache_bytes = disk_cache_mb * 1024 * 1024;

View File

@ -92,6 +92,7 @@
#include "fslslbridge.h"
#include "fsradar.h"
#include "llavataractions.h"
#include "lldiskcache.h"
#include "llfloaterreg.h"
#include "llfloatersidepanelcontainer.h"
#include "llhudtext.h"
@ -1062,6 +1063,15 @@ void handlePlayBentoIdleAnimationChanged(const LLSD& newValue)
}
// </FS:Zi>
// <FS:Ansariel> Better asset cache size control
void handleDiskCacheSizeChanged(const LLSD& newValue)
{
const unsigned int disk_cache_mb = gSavedSettings.getU32("FSDiskCacheSize");
const U64 disk_cache_bytes = disk_cache_mb * 1024 * 1024;
LLDiskCache::getInstance()->setMaxSiteBytes(disk_cache_bytes);
}
// </FS:Ansariel>
////////////////////////////////////////////////////////////////////////////
void settings_setup_listeners()
@ -1316,6 +1326,9 @@ void settings_setup_listeners()
// <FS:Zi> Run Prio 0 default bento pose in the background to fix splayed hands, open mouths, etc.
gSavedSettings.getControl("FSPlayDefaultBentoAnimation")->getSignal()->connect(boost::bind(&handlePlayBentoIdleAnimationChanged, _2));
// <FS:Ansariel> Better asset cache size control
gSavedSettings.getControl("FSDiskCacheSize")->getSignal()->connect(boost::bind(&handleDiskCacheSizeChanged, _2));
}
#if TEST_CACHED_CONTROL

View File

@ -47,7 +47,10 @@
</panel>
<panel label="Verzeichnisse" name="tab-dir">
<text name="cache_size_label_l">
Cache-Größe ([http://wiki.firestormviewer.org/cache Empfehlungen anzeigen?]):
Textur-Cache-Größe ([http://wiki.firestormviewer.org/cache Empfehlungen anzeigen?]):
</text>
<text name="asset_cache_size_label_l">
Asset-Cache-Größe :
</text>
<button label="Inventar-Cache löschen" width="137" name="ClearInventoryCache"/>
<text name="Cache location">

View File

@ -409,7 +409,7 @@
name="cache_size_label_l"
top_pad="15"
width="500">
Cache size ([http://wiki.firestormviewer.org/cache need a suggestion?]):
Texture Cache Size ([http://wiki.firestormviewer.org/cache need a suggestion?]):
</text>
<slider
can_edit_text="true"
@ -438,6 +438,46 @@
width="40">
MB
</text>
<text
type="string"
length="1"
follows="left|top"
height="10"
layout="topleft"
left="15"
mouse_opaque="false"
name="asset_cache_size_label_l"
top_pad="15"
width="500">
Asset Cache Size:
</text>
<slider
can_edit_text="true"
control_name="FSDiskCacheSize"
decimal_digits="0"
follows="left|top"
height="15"
increment="64"
initial_value="1024"
layout="topleft"
max_val="9984"
min_val="256"
top_pad="10"
name="asset_cache_size"
width="279" />
<text
type="string"
length="1"
follows="left|top"
height="10"
layout="topleft"
left_pad="6"
top_delta="1"
mouse_opaque="false"
name="asset_text_box5"
width="40">
MB
</text>
<button
enabled="false"
follows="left|top"
@ -459,7 +499,7 @@
layout="topleft"
left="15"
name="Cache location"
top_delta="20"
top_delta="25"
width="300">
Cache location:
</text>