Increased the viewer cache size limit to 10GB. Increased the default to 1GB.

* Changed the hard coded cache limit in llappviewer.cpp to 10GB as well as the
   slider maximum in the preferences menu. * The VFS cache is capped at 1GB due
   to file system limitations. The former 80/20 split between texture/vfs is
   maintained up to 5GB. Above this limit the texture cache is given all
   the additional cache space up to 10GB.
 * Fixed a log message in lltexturecache.cpp that was not showing the correct
   texture size. ER-883
 * Fixed a bug in llfloaterpreference.cpp that caused new cache value to be
   written to the old cache setting. This resulted in the the cache not being
   cleared when the location was set back to the default. ER-882
 * Disabled the "The cache will be cleared on reboot" message that is triggered
   by the reset button in the cache preferences in the case where the cache
   is already located in the default location.  The cache is only cleared when
   its location is changed. This is intended to address resident confusion
   regarding the purpose of the reset button, as demonstrated in VWR-19562.
meow-7.2.2
Logan Dethrow 2011-05-06 15:15:17 -04:00
parent b8069d1c25
commit 5c7a906b44
4 changed files with 42 additions and 31 deletions

View File

@ -3548,7 +3548,7 @@ bool LLAppViewer::initCache()
gSavedSettings.getBOOL("PurgeCacheOnNextStartup"))
{
gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false);
mPurgeCache = true;
mPurgeCache = true;
}
// We have moved the location of the cache directory over time.
@ -3583,11 +3583,23 @@ bool LLAppViewer::initCache()
// Init the texture cache
// Allocate 80% of the cache size for textures
const S32 MB = 1024*1024;
const S32 MB = 1024 * 1024;
S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB;
const S64 MAX_CACHE_SIZE = 1024*MB;
const S64 MAX_CACHE_SIZE = 10 * 1024ll * MB;
const S64 MAX_VFS_SIZE = 1024 * MB; // 1 GB
cache_size = llmin(cache_size, MAX_CACHE_SIZE);
S64 texture_cache_size = ((cache_size * 8)/10);
S64 texture_cache_size = ((cache_size * 8) / 10);
S64 vfs_size = cache_size - texture_cache_size;
if (vfs_size > MAX_VFS_SIZE)
{
// Give the texture cache more space, since the VFS can't be bigger than 1GB.
// This happens when the user's CacheSize setting is greater than 5GB.
vfs_size = MAX_VFS_SIZE;
texture_cache_size = cache_size - MAX_VFS_SIZE;
}
S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch);
texture_cache_size -= extra;
@ -3596,21 +3608,19 @@ bool LLAppViewer::initCache()
LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS"));
// Init the VFS
S64 vfs_size = cache_size - texture_cache_size;
const S64 MAX_VFS_SIZE = 1024 * MB; // 1 GB
vfs_size = llmin(vfs_size, MAX_VFS_SIZE);
vfs_size = llmin(vfs_size + extra, MAX_VFS_SIZE);
vfs_size = (vfs_size / MB) * MB; // make sure it is MB aligned
U32 vfs_size_u32 = (U32)vfs_size;
U32 old_vfs_size = gSavedSettings.getU32("VFSOldSize") * MB;
bool resize_vfs = (vfs_size_u32 != old_vfs_size);
if (resize_vfs)
{
gSavedSettings.setU32("VFSOldSize", vfs_size_u32/MB);
gSavedSettings.setU32("VFSOldSize", vfs_size_u32 / MB);
}
LL_INFOS("AppCache") << "VFS CACHE SIZE: " << vfs_size/(1024*1024) << " MB" << LL_ENDL;
LL_INFOS("AppCache") << "VFS CACHE SIZE: " << vfs_size / (1024*1024) << " MB" << LL_ENDL;
// This has to happen BEFORE starting the vfs
//time_t ltime;
// time_t ltime;
srand(time(NULL)); // Flawfinder: ignore
U32 old_salt = gSavedSettings.getU32("VFSSalt");
U32 new_salt;
@ -3631,10 +3641,10 @@ bool LLAppViewer::initCache()
do
{
new_salt = rand();
} while( new_salt == old_salt );
} while(new_salt == old_salt);
}
old_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_DATA_FILE_BASE) + llformat("%u",old_salt);
old_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_DATA_FILE_BASE) + llformat("%u", old_salt);
// make sure this file exists
llstat s;
@ -3648,7 +3658,7 @@ bool LLAppViewer::initCache()
mask += "*";
std::string dir;
dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"");
dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
std::string found_file;
if (gDirUtilp->getNextFileInDir(dir, mask, found_file))
@ -3664,7 +3674,7 @@ bool LLAppViewer::initCache()
}
}
old_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_INDEX_FILE_BASE) + llformat("%u",old_salt);
old_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_INDEX_FILE_BASE) + llformat("%u", old_salt);
stat_result = LLFile::stat(old_vfs_index_file, &s);
if (stat_result)
@ -3677,7 +3687,7 @@ bool LLAppViewer::initCache()
// Just in case, nuke any other old cache files in the directory.
std::string dir;
dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"");
dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
std::string mask;
mask = gDirUtilp->getDirDelimiter();
@ -3693,11 +3703,11 @@ bool LLAppViewer::initCache()
gDirUtilp->deleteFilesInDir(dir, mask);
}
new_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_DATA_FILE_BASE) + llformat("%u",new_salt);
new_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_INDEX_FILE_BASE) + llformat("%u",new_salt);
new_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_DATA_FILE_BASE) + llformat("%u", new_salt);
new_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_INDEX_FILE_BASE) + llformat("%u", new_salt);
static_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"static_data.db2");
static_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"static_index.db2");
static_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "static_data.db2");
static_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "static_index.db2");
if (resize_vfs)
{
@ -3720,19 +3730,19 @@ bool LLAppViewer::initCache()
// Don't remove VFS after viewer crashes. If user has corrupt data, they can reinstall. JC
gVFS = LLVFS::createLLVFS(new_vfs_index_file, new_vfs_data_file, false, vfs_size_u32, false);
if( !gVFS )
if (!gVFS)
{
return false;
}
gStaticVFS = LLVFS::createLLVFS(static_vfs_index_file, static_vfs_data_file, true, 0, false);
if( !gStaticVFS )
if (!gStaticVFS)
{
return false;
}
BOOL success = gVFS->isValid() && gStaticVFS->isValid();
if( !success )
if (!success)
{
return false;
}

View File

@ -897,14 +897,15 @@ void LLFloaterPreference::onClickSetCache()
void LLFloaterPreference::onClickResetCache()
{
if (!gSavedSettings.getString("CacheLocation").empty())
if (gDirUtilp->getCacheDir(false) == gDirUtilp->getCacheDir(true))
{
gSavedSettings.setString("NewCacheLocation", "");
gSavedSettings.setString("NewCacheLocationTopFolder", "");
// The cache location was already the default.
return;
}
gSavedSettings.setString("NewCacheLocation", "");
gSavedSettings.setString("NewCacheLocationTopFolder", "");
LLNotificationsUtil::add("CacheWillBeMoved");
std::string cache_location = gDirUtilp->getCacheDir(true);
std::string cache_location = gDirUtilp->getCacheDir(false);
gSavedSettings.setString("CacheLocation", cache_location);
std::string top_folder(gDirUtilp->getBaseFileName(cache_location));
gSavedSettings.setString("CacheLocationTopFolder", top_folder);

View File

@ -949,7 +949,7 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL texture_cache
max_size -= sCacheMaxTexturesSize;
LL_INFOS("TextureCache") << "Headers: " << sCacheMaxEntries
<< " Textures size: " << sCacheMaxTexturesSize/(1024*1024) << " MB" << LL_ENDL;
<< " Textures size: " << sCacheMaxTexturesSize / (1024 * 1024) << " MB" << LL_ENDL;
setDirNames(location);
@ -1655,7 +1655,7 @@ void LLTextureCache::purgeTextures(bool validate)
LL_INFOS("TextureCache") << "TEXTURE CACHE:"
<< " PURGED: " << purge_count
<< " ENTRIES: " << num_entries
<< " CACHE SIZE: " << mTexturesSizeTotal / 1024*1024 << " MB"
<< " CACHE SIZE: " << mTexturesSizeTotal / (1024 * 1024) << " MB"
<< llendl;
}

View File

@ -113,10 +113,10 @@
follows="left|top"
height="15"
increment="16"
initial_value="512"
initial_value="1024"
layout="topleft"
left_delta="150"
max_val="1024"
max_val="10240"
min_val="32"
name="cache_size"
top_delta="-2"