so I didnt know that

This commit is contained in:
RePixelatedMC
2023-11-29 14:43:06 +01:00
parent 815b2235a2
commit 17f8fe69fb
4 changed files with 13 additions and 8 deletions
@@ -57,7 +57,8 @@ public class CommandDeveloper implements DecreeExecutor {
Iris.info(C.DARK_PURPLE + "Engine Status"); Iris.info(C.DARK_PURPLE + "Engine Status");
Iris.info(C.DARK_PURPLE + "Tectonic Threads: " + C.LIGHT_PURPLE + engine.getMantle().getDynamicThreads()); Iris.info(C.DARK_PURPLE + "Tectonic Threads: " + C.LIGHT_PURPLE + engine.getMantle().getDynamicThreads());
Iris.info(C.DARK_PURPLE + "Tectonic Limit: " + C.LIGHT_PURPLE + engine.getMantle().getTectonicLimit()); Iris.info(C.DARK_PURPLE + "Tectonic Limit: " + C.LIGHT_PURPLE + engine.getMantle().getTectonicLimit());
Iris.info(C.DARK_PURPLE + "Tectonic Plates: " + C.LIGHT_PURPLE + engine.getMantle().getLoadedRegionCount()); Iris.info(C.DARK_PURPLE + "Tectonic Loaded Plates: " + C.LIGHT_PURPLE + engine.getMantle().getLoadedRegionCount());
Iris.info(C.DARK_PURPLE + "Tectonic Plates: " + C.LIGHT_PURPLE + engine.getMantle().getNotClearedLoadedRegions());
Iris.info(C.DARK_PURPLE + "Tectonic ToUnload: " + C.LIGHT_PURPLE + engine.getMantle().getToUnload()); Iris.info(C.DARK_PURPLE + "Tectonic ToUnload: " + C.LIGHT_PURPLE + engine.getMantle().getToUnload());
Iris.info(C.DARK_PURPLE + "Tectonic Unload Duration: " + C.LIGHT_PURPLE + Form.duration((long) engine.getMantle().getTectonicDuration())); Iris.info(C.DARK_PURPLE + "Tectonic Unload Duration: " + C.LIGHT_PURPLE + Form.duration((long) engine.getMantle().getTectonicDuration()));
Iris.info(C.DARK_PURPLE + "Cache Size: " + C.LIGHT_PURPLE + Form.f(IrisData.cacheSize())); Iris.info(C.DARK_PURPLE + "Cache Size: " + C.LIGHT_PURPLE + Form.f(IrisData.cacheSize()));
@@ -33,8 +33,8 @@ public class DynamicPerformanceSVC implements IrisService {
protected long loop() { protected long loop() {
try { try {
if (engine.getMantle().getTectonicLimit() < engine.getMantle().getLoadedRegionCount()){ if (engine.getMantle().getTectonicLimit() < engine.getMantle().getLoadedRegionCount()){
// engine.getMantle().trim(5); engine.getMantle().trim(5);
// return 2000; return 2000;
} }
} catch (Throwable e) { } catch (Throwable e) {
Iris.reportError(e); Iris.reportError(e);
@@ -301,6 +301,9 @@ public interface EngineMantle extends IObjectPlacer {
default double getTectonicLimit(){ default double getTectonicLimit(){
return Mantle.tectonicLimit.get(); return Mantle.tectonicLimit.get();
} }
default long getNotClearedLoadedRegions(){
return getMantle().getLoadedRegions().size() - getMantle().getToUnload().size();
}
default double getTectonicDuration(){ default double getTectonicDuration(){
return getMantle().getAdjustedIdleDuration().get(); return getMantle().getAdjustedIdleDuration().get();
} }
@@ -388,8 +388,6 @@ public class Mantle {
return numberOfEntries * bytesPerEntry; return numberOfEntries * bytesPerEntry;
} }
//@Getter
//private final AtomicInteger fakeToUnload = new AtomicInteger(0);
private final AtomicInteger oldFakeToUnload = new AtomicInteger((0)); private final AtomicInteger oldFakeToUnload = new AtomicInteger((0));
@Getter @Getter
private final AtomicDouble adjustedIdleDuration = new AtomicDouble(0); private final AtomicDouble adjustedIdleDuration = new AtomicDouble(0);
@@ -479,9 +477,12 @@ public class Mantle {
if (IrisSettings.get().getPerformance().AggressiveTectonicUnload if (IrisSettings.get().getPerformance().AggressiveTectonicUnload
&& loadedRegions.size() > forceAggressiveThreshold.get()) { && loadedRegions.size() > forceAggressiveThreshold.get()) {
AtomicInteger dummyLoadedRegions = new AtomicInteger(loadedRegions.size()); AtomicInteger regionCountToRemove = new AtomicInteger(0);
if (loadedRegions.size() > tectonicLimit.get()){
regionCountToRemove.set(loadedRegions.size() - tectonicLimit.get());
}
while (dummyLoadedRegions.get() > tectonicLimit.get()) { for (; regionCountToRemove.get() > 0 ;) {
Long[] oldestKey = {null}; Long[] oldestKey = {null};
long[] oldestAge = {Long.MIN_VALUE}; long[] oldestAge = {Long.MIN_VALUE};
@@ -502,7 +503,7 @@ public class Mantle {
hyperLock.withLong(finalOldestKey, () -> { hyperLock.withLong(finalOldestKey, () -> {
toUnload.add(finalOldestKey); toUnload.add(finalOldestKey);
Iris.debug("Oldest Tectonic Region " + finalOldestKey + " added to unload"); Iris.debug("Oldest Tectonic Region " + finalOldestKey + " added to unload");
dummyLoadedRegions.getAndDecrement(); regionCountToRemove.getAndDecrement();
}); });
} }
} }