mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-17 14:21:33 +00:00
Sync
This commit is contained in:
@@ -141,6 +141,7 @@ public class IrisSettings {
|
|||||||
public int resourceLoaderCacheSize = 1_024;
|
public int resourceLoaderCacheSize = 1_024;
|
||||||
public int objectLoaderCacheSize = 4_096;
|
public int objectLoaderCacheSize = 4_096;
|
||||||
public int scriptLoaderCacheSize = 512;
|
public int scriptLoaderCacheSize = 512;
|
||||||
|
public boolean dynamicPerformanceMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -53,10 +53,12 @@ public class CommandDeveloper implements DecreeExecutor {
|
|||||||
|
|
||||||
Iris.info("-------------------------");
|
Iris.info("-------------------------");
|
||||||
Iris.info(C.DARK_PURPLE + "Engine Status");
|
Iris.info(C.DARK_PURPLE + "Engine Status");
|
||||||
|
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 Plates: " + C.LIGHT_PURPLE + engine.getMantle().getLoadedRegionCount());
|
||||||
Iris.info(C.DARK_PURPLE + "Tectonic ToUnload: " + C.LIGHT_PURPLE + outputToUnload);
|
Iris.info(C.DARK_PURPLE + "Tectonic ToUnload: " + C.LIGHT_PURPLE + outputToUnload);
|
||||||
|
Iris.info(C.DARK_PURPLE + "Tectonic Unload Duration: " + C.LIGHT_PURPLE + Form.duration(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()));
|
||||||
Iris.info(C.DARK_PURPLE + "LastUse Size: " + C.LIGHT_PURPLE + Form.mem(lastUseSize) + " MB");
|
Iris.info(C.DARK_PURPLE + "LastUse Size: " + C.LIGHT_PURPLE + Form.mem(lastUseSize));
|
||||||
Iris.info("-------------------------");
|
Iris.info("-------------------------");
|
||||||
} else {
|
} else {
|
||||||
Iris.info(C.RED + "Engine is null!");
|
Iris.info(C.RED + "Engine is null!");
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import oshi.hardware.GlobalMemory;
|
|||||||
import static com.volmit.iris.util.misc.getHardware.*;
|
import static com.volmit.iris.util.misc.getHardware.*;
|
||||||
|
|
||||||
public class PerformanceSFG {
|
public class PerformanceSFG {
|
||||||
public static boolean lowPerformance = false;
|
|
||||||
public static void calculatePerformance(){
|
public static void calculatePerformance(){
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -290,15 +290,10 @@ public class IrisEngineMantle implements EngineMantle {
|
|||||||
x = 4;
|
x = 4;
|
||||||
Iris.info("Mantle Size: " + x + " Chunks " + C.BLUE + "BENCHMARK MODE");
|
Iris.info("Mantle Size: " + x + " Chunks " + C.BLUE + "BENCHMARK MODE");
|
||||||
} else {
|
} else {
|
||||||
if(lowPerformance){
|
Iris.info("Mantle Size: " + x + " Chunks");
|
||||||
x = 4;
|
Iris.info(" Object Mantle Size: " + u + " (" + ((Math.max(u, 16) + 16) >> 4) + ")");
|
||||||
Iris.info("Mantle Size: " + x + " Chunks" + C.GOLD + "LOW PERFORMANCE MODE");
|
Iris.info(" Jigsaw Mantle Size: " + jig + " (" + ((Math.max(jig, 16) + 16) >> 4) + ")");
|
||||||
} else {
|
Iris.info(" Carving Mantle Size: " + c + " (" + ((Math.max(c, 16) + 16) >> 4) + ")");
|
||||||
Iris.info("Mantle Size: " + x + " Chunks");
|
|
||||||
Iris.info(" Object Mantle Size: " + u + " (" + ((Math.max(u, 16) + 16) >> 4) + ")");
|
|
||||||
Iris.info(" Jigsaw Mantle Size: " + jig + " (" + ((Math.max(jig, 16) + 16) >> 4) + ")");
|
|
||||||
Iris.info(" Carving Mantle Size: " + c + " (" + ((Math.max(c, 16) + 16) >> 4) + ")");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -295,4 +295,10 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
default long getToUnload(){
|
default long getToUnload(){
|
||||||
return getMantle().ToUnloadTectonic();
|
return getMantle().ToUnloadTectonic();
|
||||||
}
|
}
|
||||||
|
default long getTectonicLimit(){
|
||||||
|
return getTectonicLimit();
|
||||||
|
}
|
||||||
|
default long getTectonicDuration(){
|
||||||
|
return getMantle().getTectonicUnloadDuration();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.mantle;
|
package com.volmit.iris.util.mantle;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.AtomicDouble;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
@@ -73,7 +74,6 @@ public class Mantle {
|
|||||||
long apm = getHardware.getAvailableProcessMemory();
|
long apm = getHardware.getAvailableProcessMemory();
|
||||||
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||||
int tectonicLimitBeforeOutMemory;
|
int tectonicLimitBeforeOutMemory;
|
||||||
double tectonicLimit = 30;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new mantle
|
* Create a new mantle
|
||||||
@@ -400,29 +400,43 @@ public class Mantle {
|
|||||||
*
|
*
|
||||||
* @param baseIdleDuration the duration
|
* @param baseIdleDuration the duration
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
AtomicInteger FakeToUnload = new AtomicInteger(0);
|
AtomicInteger FakeToUnload = new AtomicInteger(0);
|
||||||
|
AtomicDouble adjustedIdleDuration = new AtomicDouble(0);
|
||||||
|
double tectonicLimit = 30;
|
||||||
|
|
||||||
|
|
||||||
public synchronized void trim(long baseIdleDuration) {
|
public synchronized void trim(long baseIdleDuration) {
|
||||||
if (closed.get()) {
|
if (closed.get()) {
|
||||||
throw new RuntimeException("The Mantle is closed");
|
throw new RuntimeException("The Mantle is closed");
|
||||||
}
|
}
|
||||||
|
if (IrisSettings.get().getPerformance().dynamicPerformanceMode){
|
||||||
|
tectonicLimit = 2;
|
||||||
|
long t = getHardware.getProcessMemory();
|
||||||
|
for (; t > 250;){
|
||||||
|
tectonicLimit++;
|
||||||
|
t = t - 250;
|
||||||
|
}
|
||||||
|
|
||||||
double adjustedIdleDuration = baseIdleDuration;
|
}
|
||||||
|
|
||||||
|
adjustedIdleDuration.set(baseIdleDuration);
|
||||||
|
|
||||||
if (loadedRegions.size() > tectonicLimit) {
|
if (loadedRegions.size() > tectonicLimit) {
|
||||||
adjustedIdleDuration = Math.max(adjustedIdleDuration - (1000 * (loadedRegions.size() - tectonicLimit) * 1.35), 4000);
|
adjustedIdleDuration.set(Math.max(adjustedIdleDuration.get() - (1000 * (loadedRegions.size() - tectonicLimit) * 1.35), 4000));
|
||||||
|
if (getHardware.getProcessMemory() < 5000 && IrisSettings.get().getPerformance().dynamicPerformanceMode) {
|
||||||
|
adjustedIdleDuration.set(Math.max(adjustedIdleDuration.get() - (1000 * (loadedRegions.size() - tectonicLimit) * 2.65), 4000));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
io.set(true);
|
io.set(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Iris.debug("Trimming Tectonic Plates older than " + Form.duration(adjustedIdleDuration, 0));
|
Iris.debug("Trimming Tectonic Plates older than " + Form.duration(adjustedIdleDuration.get(), 0));
|
||||||
Set<Long> toUnload = new HashSet<>();
|
Set<Long> toUnload = new HashSet<>();
|
||||||
|
|
||||||
for (Long i : lastUse.keySet()) {
|
for (Long i : lastUse.keySet()) {
|
||||||
double finalAdjustedIdleDuration = adjustedIdleDuration;
|
double finalAdjustedIdleDuration = adjustedIdleDuration.get();
|
||||||
hyperLock.withLong(i, () -> {
|
hyperLock.withLong(i, () -> {
|
||||||
if (M.ms() - lastUse.get(i) >= finalAdjustedIdleDuration) {
|
if (M.ms() - lastUse.get(i) >= finalAdjustedIdleDuration) {
|
||||||
toUnload.add(i);
|
toUnload.add(i);
|
||||||
@@ -463,6 +477,9 @@ public class Mantle {
|
|||||||
public long ToUnloadTectonic(){
|
public long ToUnloadTectonic(){
|
||||||
return FakeToUnload.get();
|
return FakeToUnload.get();
|
||||||
}
|
}
|
||||||
|
public double getTectonicUnloadDuration(){
|
||||||
|
return adjustedIdleDuration.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user