2025-11-24 22:52:51 +03:00

48 lines
1.4 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.util.profiling;
import java.util.function.BooleanSupplier;
import java.util.function.IntSupplier;
import java.util.function.LongSupplier;
import net.minecraft.util.profiling.ActiveProfiler;
import net.minecraft.util.profiling.InactiveProfiler;
import net.minecraft.util.profiling.ProfileCollector;
import net.minecraft.util.profiling.ProfileResults;
import net.minecraft.util.profiling.ProfilerFiller;
public class ContinuousProfiler {
private final LongSupplier realTime;
private final IntSupplier tickCount;
private final BooleanSupplier suppressWarnings;
private ProfileCollector profiler = InactiveProfiler.INSTANCE;
public ContinuousProfiler(LongSupplier realTime, IntSupplier tickCount, BooleanSupplier suppressWarnings) {
this.realTime = realTime;
this.tickCount = tickCount;
this.suppressWarnings = suppressWarnings;
}
public boolean isEnabled() {
return this.profiler != InactiveProfiler.INSTANCE;
}
public void disable() {
this.profiler = InactiveProfiler.INSTANCE;
}
public void enable() {
this.profiler = new ActiveProfiler(this.realTime, this.tickCount, this.suppressWarnings);
}
public ProfilerFiller getFiller() {
return this.profiler;
}
public ProfileResults getResults() {
return this.profiler.getResults();
}
}