Search in sources :

Example 1 with ProfilerResult

use of com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult in project KahzerxMod by otakucraft.

the class BlockEntitiesProfiler method onTick.

@Override
public void onTick(MinecraftServer server, String id) {
    blockEntityList.add(new BlockEntityInstance("", "", 0.0D, 0.0D, 0.0D));
    this.addResult(server.getTicks(), new ProfilerResult("block_entities", id, new ArrayList<>(blockEntityList)));
    blockEntityList.clear();
}
Also used : ArrayList(java.util.ArrayList) BlockEntityInstance(com.kahzerx.kahzerxmod.profiler.instances.BlockEntityInstance) ProfilerResult(com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult)

Example 2 with ProfilerResult

use of com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult in project KahzerxMod by otakucraft.

the class TPSProfiler method onTick.

@Override
public void onTick(MinecraftServer server, String id) {
    if (server.getTicks() % TPS_SAMPLE_INTERVAL != 0) {
        this.addResult(server.getTicks(), new ProfilerResult("tps", id, new TPSInstance(tps5Sec(), tps10Sec(), tps1Min(), tps5Min(), tps10Min())));
        return;
    }
    long now = System.nanoTime();
    if (this.lastTickTime == 0) {
        this.addResult(server.getTicks(), new ProfilerResult("tps", id, new TPSInstance(20.0D, 20.0D, 20.0D, 20.0D, 20.0D)));
        this.lastTickTime = now;
        return;
    }
    long diff = now - this.lastTickTime;
    BigDecimal currentTps = TPS_BASE.divide(new BigDecimal(diff), 30, RoundingMode.HALF_UP);
    BigDecimal total = currentTps.multiply(new BigDecimal(diff));
    for (TpsRollingAverage rollingAverage : this.tpsAverages) {
        rollingAverage.add(currentTps, diff, total);
    }
    this.lastTickTime = now;
    this.addResult(server.getTicks(), new ProfilerResult("tps", id, new TPSInstance(tps5Sec(), tps10Sec(), tps1Min(), tps5Min(), tps10Min())));
}
Also used : TPSInstance(com.kahzerx.kahzerxmod.profiler.instances.TPSInstance) ProfilerResult(com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult) BigDecimal(java.math.BigDecimal)

Example 3 with ProfilerResult

use of com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult in project KahzerxMod by otakucraft.

the class ChunkProfiler method onTick.

@Override
public void onTick(MinecraftServer server, String id) {
    chunkList.add(new ChunkInstance("", 0, 0));
    this.addResult(server.getTicks(), new ProfilerResult("loaded_chunks", id, new ArrayList<>(chunkList)));
    chunkList.clear();
}
Also used : ChunkInstance(com.kahzerx.kahzerxmod.profiler.instances.ChunkInstance) ArrayList(java.util.ArrayList) ProfilerResult(com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult)

Example 4 with ProfilerResult

use of com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult in project KahzerxMod by otakucraft.

the class EntityProfiler method onTick.

@Override
public void onTick(MinecraftServer server, String id) {
    entityList.add(new EntityInstance("", "", 0.0D, 0.0D, 0.0D));
    this.addResult(server.getTicks(), new ProfilerResult("entities", id, new ArrayList<>(entityList)));
    entityList.clear();
}
Also used : ArrayList(java.util.ArrayList) EntityInstance(com.kahzerx.kahzerxmod.profiler.instances.EntityInstance) ProfilerResult(com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult)

Example 5 with ProfilerResult

use of com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult in project KahzerxMod by otakucraft.

the class MSPTProfiler method onTick.

@Override
public void onTick(MinecraftServer server, String id) {
    double MSPT = MathHelper.average(server.lastTickLengths) * 1.0E-6D;
    this.addResult(server.getTicks(), new ProfilerResult("mspt", id, new MSPTInstance(MSPT)));
}
Also used : MSPTInstance(com.kahzerx.kahzerxmod.profiler.instances.MSPTInstance) ProfilerResult(com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult)

Aggregations

ProfilerResult (com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult)7 ArrayList (java.util.ArrayList)4 BlockEntityInstance (com.kahzerx.kahzerxmod.profiler.instances.BlockEntityInstance)1 ChunkInstance (com.kahzerx.kahzerxmod.profiler.instances.ChunkInstance)1 EntityInstance (com.kahzerx.kahzerxmod.profiler.instances.EntityInstance)1 MSPTInstance (com.kahzerx.kahzerxmod.profiler.instances.MSPTInstance)1 PlayersInstance (com.kahzerx.kahzerxmod.profiler.instances.PlayersInstance)1 RamInstance (com.kahzerx.kahzerxmod.profiler.instances.RamInstance)1 TPSInstance (com.kahzerx.kahzerxmod.profiler.instances.TPSInstance)1 BigDecimal (java.math.BigDecimal)1 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)1 ServerWorld (net.minecraft.server.world.ServerWorld)1