MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / initializeKnobsCaching

Method initializeKnobsCaching

Engine/Settings.cpp:1220–1320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1218} // Settings::initializeKnobsNodeGraph
1219
1220void
1221Settings::initializeKnobsCaching()
1222{
1223 /////////// Caching tab
1224 _cachingTab = AppManager::createKnob<KnobPage>( this, tr("Caching") );
1225
1226 _aggressiveCaching = AppManager::createKnob<KnobBool>( this, tr("Aggressive caching") );
1227 _aggressiveCaching->setName("aggressiveCaching");
1228 _aggressiveCaching->setHintToolTip( tr("When checked, %1 will cache the output of all images "
1229 "rendered by all nodes, regardless of their \"Force caching\" parameter. When enabling this option "
1230 "you need to have at least 8GiB of RAM, and 16GiB is recommended.\n"
1231 "If not checked, %1 will only cache the nodes "
1232 "which have multiple outputs, or their parameter \"Force caching\" checked or if one of its "
1233 "output has its settings panel opened.").arg( QString::fromUtf8(NATRON_APPLICATION_NAME) ) );
1234 _cachingTab->addKnob(_aggressiveCaching);
1235
1236 _maxRAMPercent = AppManager::createKnob<KnobInt>( this, tr("Maximum amount of RAM memory used for caching (% of total RAM)") );
1237 _maxRAMPercent->setName("maxRAMPercent");
1238 _maxRAMPercent->disableSlider();
1239 _maxRAMPercent->setMinimum(0);
1240 _maxRAMPercent->setMaximum(100);
1241 QString ramHint( tr("This setting indicates the percentage of the total RAM which can be used by the memory caches. "
1242 "This system has %1 of RAM.").arg( printAsRAM( getSystemTotalRAM() ) ) );
1243 if ( isApplication32Bits() && (getSystemTotalRAM() > 4ULL * 1024ULL * 1024ULL * 1024ULL) ) {
1244 ramHint.append( QString::fromUtf8("\n") );
1245 ramHint.append( tr("The version of %1 you are running is 32 bits, which means the available RAM "
1246 "is limited to 4GiB. The amount of RAM used for caching is 4GiB * MaxRamPercent.").arg( QString::fromUtf8(NATRON_APPLICATION_NAME) ) );
1247 }
1248
1249 _maxRAMPercent->setHintToolTip(ramHint);
1250 _maxRAMPercent->setAddNewLine(false);
1251 _cachingTab->addKnob(_maxRAMPercent);
1252
1253 _maxRAMLabel = AppManager::createKnob<KnobString>( this, std::string() );
1254 _maxRAMLabel->setName("maxRamLabel");
1255 _maxRAMLabel->setIsPersistent(false);
1256 _maxRAMLabel->setAsLabel();
1257 _cachingTab->addKnob(_maxRAMLabel);
1258
1259
1260 _unreachableRAMPercent = AppManager::createKnob<KnobInt>( this, tr("System RAM to keep free (% of total RAM)") );
1261 _unreachableRAMPercent->setName("unreachableRAMPercent");
1262 _unreachableRAMPercent->disableSlider();
1263 _unreachableRAMPercent->setMinimum(0);
1264 _unreachableRAMPercent->setMaximum(90);
1265 _unreachableRAMPercent->setHintToolTip(tr("This determines how much RAM should be kept free for other applications "
1266 "running on the same system. "
1267 "When this limit is reached, the caches start recycling memory instead of growing. "
1268 //"A reasonable value should be set for it allowing the caches to stay in physical RAM " // users don't understand what swap is
1269 //"and avoid being swapped-out on disk. "
1270 "This value should reflect the amount of memory "
1271 "you want to keep available on your computer for other usage. "
1272 "A low value may result in a massive slowdown and high disk usage.")
1273 );
1274 _unreachableRAMPercent->setAddNewLine(false);
1275 _cachingTab->addKnob(_unreachableRAMPercent);
1276 _unreachableRAMLabel = AppManager::createKnob<KnobString>( this, std::string() );
1277 _unreachableRAMLabel->setName("unreachableRAMLabel");

Callers

nothing calls this directly

Calls 14

printAsRAMFunction · 0.85
getSystemTotalRAMFunction · 0.85
isApplication32BitsFunction · 0.85
appendMethod · 0.80
setIsPersistentMethod · 0.80
setAsLabelMethod · 0.80
setMultiPathMethod · 0.80
setNameMethod · 0.45
setHintToolTipMethod · 0.45
addKnobMethod · 0.45
disableSliderMethod · 0.45
setMinimumMethod · 0.45

Tested by

no test coverage detected