Add world join profiling

This commit is contained in:
embeddedt 2025-05-30 21:35:52 -04:00
parent 6e591f5ace
commit 94271b866b
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
4 changed files with 41 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import org.embeddedt.modernfix.platform.ModernFixPlatformHooks;
import org.embeddedt.modernfix.searchtree.JEIBackedSearchTree;
import org.embeddedt.modernfix.searchtree.REIBackedSearchTree;
import org.embeddedt.modernfix.searchtree.SearchTreeProviderRegistry;
import org.embeddedt.modernfix.spark.SparkLaunchProfiler;
import org.embeddedt.modernfix.util.ClassInfoManager;
import org.embeddedt.modernfix.world.IntegratedWatchdog;
@ -100,6 +101,9 @@ public class ModernFixClient {
ModernFix.LOGGER.warn("Time from main menu to in-game was " + timeSpentLoading + " seconds");
ModernFix.LOGGER.warn("Total time to load game and open world was " + (timeSpentLoading + gameStartTimeSeconds) + " seconds");
}
if (ModernFixPlatformHooks.INSTANCE.modPresent("spark") && ModernFixMixinPlugin.instance.isOptionEnabled("feature.spark_profile_world_join.WorldJoin")) {
SparkLaunchProfiler.stop("world_join");
}
resetWorldLoadStateMachine();
}
}

View File

@ -0,0 +1,18 @@
package org.embeddedt.modernfix.common.mixin.feature.spark_profile_world_join;
import net.minecraft.client.Minecraft;
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
import org.embeddedt.modernfix.spark.SparkLaunchProfiler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
@ClientOnlyMixin
public class MinecraftMixin {
@Inject(method = "prepareForMultiplayer", at = @At("HEAD"))
private void startProfiling(CallbackInfo ci) {
SparkLaunchProfiler.start("world_join");
}
}

View File

@ -0,0 +1,18 @@
package org.embeddedt.modernfix.common.mixin.feature.spark_profile_world_join;
import net.minecraft.server.WorldLoader;
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
import org.embeddedt.modernfix.spark.SparkLaunchProfiler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(WorldLoader.class)
@ClientOnlyMixin
public class WorldLoaderMixin {
@Inject(method = "load", at = @At("HEAD"))
private static void startProfiling(CallbackInfoReturnable<?> cir) {
SparkLaunchProfiler.start("world_join");
}
}

View File

@ -182,6 +182,7 @@ public class ModernFixEarlyConfig {
.put("mixin.feature.snapshot_easter_egg", true)
.put("mixin.feature.warn_missing_perf_mods", true)
.put("mixin.feature.spark_profile_launch", false)
.put("mixin.feature.spark_profile_world_join", false)
.put("mixin.feature.log_stdout_in_log_files", true)
.put("mixin.devenv", isDevEnv)
.put("mixin.perf.remove_spawn_chunks", isDevEnv)