Measure vanilla bootstrap time
This commit is contained in:
parent
611a8e18cb
commit
eb99ce47d8
|
|
@ -0,0 +1,31 @@
|
||||||
|
package org.embeddedt.modernfix.mixin.feature.measure_time;
|
||||||
|
|
||||||
|
import com.google.common.base.Stopwatch;
|
||||||
|
import net.minecraft.util.registry.Bootstrap;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Mixin(Bootstrap.class)
|
||||||
|
public class BootstrapMixin {
|
||||||
|
@Shadow @Final private static Logger LOGGER;
|
||||||
|
private static Stopwatch startWatch;
|
||||||
|
@Inject(method = "bootStrap", at = @At(value = "FIELD", opcode = Opcodes.PUTSTATIC, target = "Lnet/minecraft/util/registry/Bootstrap;isBootstrapped:Z", ordinal = 0))
|
||||||
|
private static void recordStartTime(CallbackInfo ci) {
|
||||||
|
startWatch = Stopwatch.createStarted();
|
||||||
|
}
|
||||||
|
@Inject(method = "bootStrap", at = @At("RETURN"))
|
||||||
|
private static void printStartTime(CallbackInfo ci) {
|
||||||
|
if(startWatch != null && startWatch.isRunning()) {
|
||||||
|
startWatch.stop();
|
||||||
|
LOGGER.info("Vanilla bootstrap took " + startWatch.elapsed(TimeUnit.MILLISECONDS) + " milliseconds");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -24,7 +24,8 @@
|
||||||
"perf.sync_executor_sleep.SyncExecutorMixin",
|
"perf.sync_executor_sleep.SyncExecutorMixin",
|
||||||
"perf.compress_biome_container.MixinBiomeContainer",
|
"perf.compress_biome_container.MixinBiomeContainer",
|
||||||
"perf.nuke_empty_chunk_sections.MixinChunk",
|
"perf.nuke_empty_chunk_sections.MixinChunk",
|
||||||
"perf.cache_blockstate_cache_arrays.AbstractBlockStateCacheMixin"
|
"perf.cache_blockstate_cache_arrays.AbstractBlockStateCacheMixin",
|
||||||
|
"feature.measure_time.BootstrapMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"feature.measure_time.MinecraftMixin",
|
"feature.measure_time.MinecraftMixin",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user