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

Method initializeKnobsCaching

Engine/Settings.cpp:1190–1287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1188} // Settings::initializeKnobsNodeGraph
1189
1190void
1191Settings::initializeKnobsCaching()
1192{
1193 /////////// Caching tab
1194 _cachingTab = AppManager::createKnob<KnobPage>( this, tr("Caching") );
1195
1196 _aggressiveCaching = AppManager::createKnob<KnobBool>( this, tr("Aggressive caching") );
1197 _aggressiveCaching->setName("aggressiveCaching");
1198 _aggressiveCaching->setHintToolTip( tr("When checked, %1 will cache the output of all images "
1199 "rendered by all nodes, regardless of their \"Force caching\" parameter. When enabling this option "
1200 "you need to have at least 8GiB of RAM, and 16GiB is recommended.\n"
1201 "If not checked, %1 will only cache the nodes "
1202 "which have multiple outputs, or their parameter \"Force caching\" checked or if one of its "
1203 "output has its settings panel opened.").arg( QString::fromUtf8(NATRON_APPLICATION_NAME) ) );
1204 _cachingTab->addKnob(_aggressiveCaching);
1205
1206 _maxRAMPercent = AppManager::createKnob<KnobInt>( this, tr("Maximum amount of RAM memory used for caching (% of total RAM)") );
1207 _maxRAMPercent->setName("maxRAMPercent");
1208 _maxRAMPercent->disableSlider();
1209 _maxRAMPercent->setMinimum(0);
1210 _maxRAMPercent->setMaximum(100);
1211 QString ramHint( tr("This setting indicates the percentage of the total RAM which can be used by the memory caches. "
1212 "This system has %1 of RAM.").arg( printAsRAM( getSystemTotalRAM() ) ) );
1213 if ( isApplication32Bits() && (getSystemTotalRAM() > 4ULL * 1024ULL * 1024ULL * 1024ULL) ) {
1214 ramHint.append( QString::fromUtf8("\n") );
1215 ramHint.append( tr("The version of %1 you are running is 32 bits, which means the available RAM "
1216 "is limited to 4GiB. The amount of RAM used for caching is 4GiB * MaxRamPercent.").arg( QString::fromUtf8(NATRON_APPLICATION_NAME) ) );
1217 }
1218
1219 _maxRAMPercent->setHintToolTip(ramHint);
1220 _maxRAMPercent->setAddNewLine(false);
1221 _cachingTab->addKnob(_maxRAMPercent);
1222
1223 _maxRAMLabel = AppManager::createKnob<KnobString>( this, std::string() );
1224 _maxRAMLabel->setName("maxRamLabel");
1225 _maxRAMLabel->setIsPersistent(false);
1226 _maxRAMLabel->setAsLabel();
1227 _cachingTab->addKnob(_maxRAMLabel);
1228
1229
1230 _unreachableRAMPercent = AppManager::createKnob<KnobInt>( this, tr("System RAM to keep free (% of total RAM)") );
1231 _unreachableRAMPercent->setName("unreachableRAMPercent");
1232 _unreachableRAMPercent->disableSlider();
1233 _unreachableRAMPercent->setMinimum(0);
1234 _unreachableRAMPercent->setMaximum(90);
1235 _unreachableRAMPercent->setHintToolTip(tr("This determines how much RAM should be kept free for other applications "
1236 "running on the same system. "
1237 "When this limit is reached, the caches start recycling memory instead of growing. "
1238 //"A reasonable value should be set for it allowing the caches to stay in physical RAM " // users don't understand what swap is
1239 //"and avoid being swapped-out on disk. "
1240 "This value should reflect the amount of memory "
1241 "you want to keep available on your computer for other usage. "
1242 "A low value may result in a massive slowdown and high disk usage.")
1243 );
1244 _unreachableRAMPercent->setAddNewLine(false);
1245 _cachingTab->addKnob(_unreachableRAMPercent);
1246 _unreachableRAMLabel = AppManager::createKnob<KnobString>( this, std::string() );
1247 _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