Remove thread preset "paid for whole cpu" and tweak CPU preset options

This commit is contained in:
James Seibel
2023-08-01 07:27:25 -05:00
parent d9ef3670fa
commit 61c8288b99
3 changed files with 30 additions and 28 deletions
@@ -43,6 +43,8 @@ public enum EThreadPreset
LOW_IMPACT,
BALANCED,
AGGRESSIVE,
I_PAID_FOR_THE_WHOLE_CPU;
// temporarily removed due to stability concerns
//I_PAID_FOR_THE_WHOLE_CPU;
}
@@ -833,7 +833,7 @@ public class Config
public static final ConfigEntry<Integer> numberOfDataTransformerThreads = new ConfigEntry.Builder<Integer>()
.setMinDefaultMax(1,
ThreadPresetConfigEventHandler.getDataConverterDefaultThreadCount(),
ThreadPresetConfigEventHandler.getDataTransformerDefaultThreadCount(),
Runtime.getRuntime().availableProcessors())
.comment(""
+ "How many threads should be used when converting full ID data to render data? \n"
@@ -848,7 +848,7 @@ public class Config
+ THREAD_NOTE)
.build();
public static final ConfigEntry<Double> runTimeRatioForDataTransformerThreads = new ConfigEntry.Builder<Double>()
.setMinDefaultMax(0.01, ThreadPresetConfigEventHandler.getDataConverterDefaultRunTimeRatio(), 1.0)
.setMinDefaultMax(0.01, ThreadPresetConfigEventHandler.getDataTransformerDefaultRunTimeRatio(), 1.0)
.comment(THREAD_RUN_TIME_RATIO_NOTE)
.build();
@@ -18,7 +18,7 @@ public class ThreadPresetConfigEventHandler extends AbstractPresetConfigEventHan
public static final ThreadPresetConfigEventHandler INSTANCE = new ThreadPresetConfigEventHandler();
private static final Logger LOGGER = LogManager.getLogger();
private static final boolean LOW_THREAD_COUNT_CPU = (Runtime.getRuntime().availableProcessors() < 4);
private static final boolean LOW_THREAD_COUNT_CPU = (Runtime.getRuntime().availableProcessors() <= 4);
@@ -28,9 +28,9 @@ public class ThreadPresetConfigEventHandler extends AbstractPresetConfigEventHan
{{
this.put(EThreadPreset.MINIMAL_IMPACT, 1);
this.put(EThreadPreset.LOW_IMPACT, getWorldGenDefaultThreadCount());
this.put(EThreadPreset.BALANCED, getThreadCountByPercent(0.3));
this.put(EThreadPreset.AGGRESSIVE, getThreadCountByPercent(0.4));
this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0));
this.put(EThreadPreset.BALANCED, getThreadCountByPercent(0.4));
this.put(EThreadPreset.AGGRESSIVE, getThreadCountByPercent(0.6));
//this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0));
}});
public static double getWorldGenDefaultRunTimeRatio() { return LOW_THREAD_COUNT_CPU ? 0.5 : 1; }
private final ConfigEntryWithPresetOptions<EThreadPreset, Double> worldGenRunTime = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.MultiThreading.runTimeRatioForWorldGenerationThreads,
@@ -40,7 +40,7 @@ public class ThreadPresetConfigEventHandler extends AbstractPresetConfigEventHan
this.put(EThreadPreset.LOW_IMPACT, getWorldGenDefaultRunTimeRatio());
this.put(EThreadPreset.BALANCED, LOW_THREAD_COUNT_CPU ? 0.5 : 1.0);
this.put(EThreadPreset.AGGRESSIVE, LOW_THREAD_COUNT_CPU ? 0.75 : 1.0);
this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0);
//this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0);
}});
@@ -52,17 +52,17 @@ public class ThreadPresetConfigEventHandler extends AbstractPresetConfigEventHan
this.put(EThreadPreset.LOW_IMPACT, getBufferBuilderDefaultThreadCount());
this.put(EThreadPreset.BALANCED, getThreadCountByPercent(0.2));
this.put(EThreadPreset.AGGRESSIVE, getThreadCountByPercent(0.4));
this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0));
//this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0));
}});
public static double getBufferBuilderDefaultRunTimeRatio() { return 0.5; }
public static double getBufferBuilderDefaultRunTimeRatio() { return LOW_THREAD_COUNT_CPU ? 0.5 : 0.75; }
private final ConfigEntryWithPresetOptions<EThreadPreset, Double> bufferBuilderRunTime = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.MultiThreading.runTimeRatioForBufferBuilderThreads,
new HashMap<EThreadPreset, Double>()
{{
this.put(EThreadPreset.MINIMAL_IMPACT, 0.25);
this.put(EThreadPreset.LOW_IMPACT, getBufferBuilderDefaultRunTimeRatio());
this.put(EThreadPreset.BALANCED, 0.75);
this.put(EThreadPreset.BALANCED, LOW_THREAD_COUNT_CPU ? 0.75 : 1.0);
this.put(EThreadPreset.AGGRESSIVE, 1.0);
this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0);
//this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0);
}});
@@ -74,7 +74,7 @@ public class ThreadPresetConfigEventHandler extends AbstractPresetConfigEventHan
this.put(EThreadPreset.LOW_IMPACT, getFileHandlerDefaultThreadCount());
this.put(EThreadPreset.BALANCED, getThreadCountByPercent(0.2));
this.put(EThreadPreset.AGGRESSIVE, getThreadCountByPercent(0.2));
this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0));
//this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0));
}});
public static double getFileHandlerDefaultRunTimeRatio() { return 0.5; }
private final ConfigEntryWithPresetOptions<EThreadPreset, Double> fileHandlerRunTime = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.MultiThreading.runTimeRatioForFileHandlerThreads,
@@ -84,29 +84,29 @@ public class ThreadPresetConfigEventHandler extends AbstractPresetConfigEventHan
this.put(EThreadPreset.LOW_IMPACT, getFileHandlerDefaultRunTimeRatio());
this.put(EThreadPreset.BALANCED, 0.75);
this.put(EThreadPreset.AGGRESSIVE, 1.0);
this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0);
//this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0);
}});
public static int getDataConverterDefaultThreadCount() { return getThreadCountByPercent(0.1); }
public static int getDataTransformerDefaultThreadCount() { return getThreadCountByPercent(0.1); }
private final ConfigEntryWithPresetOptions<EThreadPreset, Integer> dataTransformerThreadCount = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.MultiThreading.numberOfDataTransformerThreads,
new HashMap<EThreadPreset, Integer>()
{{
this.put(EThreadPreset.MINIMAL_IMPACT, 1);
this.put(EThreadPreset.LOW_IMPACT, getDataConverterDefaultThreadCount());
this.put(EThreadPreset.LOW_IMPACT, getDataTransformerDefaultThreadCount());
this.put(EThreadPreset.BALANCED, getThreadCountByPercent(0.2));
this.put(EThreadPreset.AGGRESSIVE, getThreadCountByPercent(0.2));
this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0));
//this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0));
}});
public static double getDataConverterDefaultRunTimeRatio() { return 0.25; }
public static double getDataTransformerDefaultRunTimeRatio() { return LOW_THREAD_COUNT_CPU ? 0.5 : 1; }
private final ConfigEntryWithPresetOptions<EThreadPreset, Double> dataTransformerRunTime = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.MultiThreading.runTimeRatioForDataTransformerThreads,
new HashMap<EThreadPreset, Double>()
{{
this.put(EThreadPreset.MINIMAL_IMPACT, 0.1);
this.put(EThreadPreset.LOW_IMPACT, getDataConverterDefaultRunTimeRatio());
this.put(EThreadPreset.BALANCED, 0.75);
this.put(EThreadPreset.MINIMAL_IMPACT, 0.25);
this.put(EThreadPreset.LOW_IMPACT, getDataTransformerDefaultRunTimeRatio());
this.put(EThreadPreset.BALANCED, LOW_THREAD_COUNT_CPU ? 0.75 : 1);
this.put(EThreadPreset.AGGRESSIVE, 1.0);
this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0);
//this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0);
}});
@@ -118,17 +118,17 @@ public class ThreadPresetConfigEventHandler extends AbstractPresetConfigEventHan
this.put(EThreadPreset.LOW_IMPACT, getChunkLodConverterDefaultThreadCount());
this.put(EThreadPreset.BALANCED, getThreadCountByPercent(0.2));
this.put(EThreadPreset.AGGRESSIVE, getThreadCountByPercent(0.4));
this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0));
//this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0));
}});
public static double getChunkLodConverterDefaultRunTimeRatio() { return 0.5; }
public static double getChunkLodConverterDefaultRunTimeRatio() { return LOW_THREAD_COUNT_CPU ? 0.5 : 0.75; }
private final ConfigEntryWithPresetOptions<EThreadPreset, Double> chunkLodConverterRunTime = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.MultiThreading.runTimeRatioForChunkLodConverterThreads,
new HashMap<EThreadPreset, Double>()
{{
this.put(EThreadPreset.MINIMAL_IMPACT, 0.25);
this.put(EThreadPreset.LOW_IMPACT, getDataConverterDefaultRunTimeRatio());
this.put(EThreadPreset.BALANCED, 0.75);
this.put(EThreadPreset.MINIMAL_IMPACT, LOW_THREAD_COUNT_CPU ? 0.1 : 0.25);
this.put(EThreadPreset.LOW_IMPACT, getDataTransformerDefaultRunTimeRatio());
this.put(EThreadPreset.BALANCED, LOW_THREAD_COUNT_CPU ? 0.75 : 1);
this.put(EThreadPreset.AGGRESSIVE, 1.0);
this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0);
//this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0);
}});