Search in sources :

Example 6 with ProfilerResult

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

the class PlayersProfiler method onTick.

@Override
public void onTick(MinecraftServer server, String id) {
    List<PlayersInstance> playerList = new ArrayList<>();
    for (ServerWorld world : server.getWorlds()) {
        for (ServerPlayerEntity player : world.getPlayers()) {
            playerList.add(new PlayersInstance(player.getName().getString(), player.getUuidAsString(), world.getRegistryKey().getValue().getPath(), player.getX(), player.getY(), player.getZ()));
        }
    }
    playerList.add(new PlayersInstance("", "", "", 0.0D, 0.0D, 0.0D));
    this.addResult(server.getTicks(), new ProfilerResult("online_players", id, playerList));
}
Also used : ServerWorld(net.minecraft.server.world.ServerWorld) ArrayList(java.util.ArrayList) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) PlayersInstance(com.kahzerx.kahzerxmod.profiler.instances.PlayersInstance) ProfilerResult(com.kahzerx.kahzerxmod.profiler.instances.ProfilerResult)

Example 7 with ProfilerResult

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

the class RamProfiler method onTick.

@Override
public void onTick(MinecraftServer server, String id) {
    Runtime runtime = Runtime.getRuntime();
    long maxMemory = runtime.maxMemory() / 1024 / 1024 / 1024;
    long allocatedMemory = runtime.totalMemory() / 1024 / 1024 / 1024;
    long freeMemory = runtime.freeMemory() / 1024 / 1024 / 1024;
    this.addResult(server.getTicks(), new ProfilerResult("ram", id, new RamInstance((double) maxMemory, (double) allocatedMemory, (double) freeMemory)));
}
Also used : RamInstance(com.kahzerx.kahzerxmod.profiler.instances.RamInstance) 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