Files
KeYiMC/patches/server/0019-Remove-Timings.patch
2022-12-09 23:36:52 +08:00

1461 lines
79 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me>
Date: Fri, 9 Dec 2022 23:13:01 +0800
Subject: [PATCH] Remove Timings
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
index 830d863cd9665d58875bfa5ca2bcd22f89ab2d49..e5d9c6f2cbe11c2ded6d8ad111fa6a8b2086dfba 100644
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
@@ -915,9 +915,9 @@ public final class ChunkHolderManager {
}
public boolean processTicketUpdates() {
- //co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager // Purpur
+ co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager
return this.processTicketUpdates(true, true, null);
- //} finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager // Purpur
+ } finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager
}
private static final ThreadLocal<List<ChunkProgressionTask>> CURRENT_TICKET_UPDATE_SCHEDULING = new ThreadLocal<>();
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
index e42eb93fd9f6f51ff5bb4b14a2304d4ffcdd8441..8013dd333e27aa5fd0beb431fa32491eec9f5246 100644
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
@@ -1750,7 +1750,7 @@ public final class NewChunkHolder {
boolean canSavePOI = !(chunk instanceof LevelChunk levelChunk && levelChunk.mustNotSave) && (poi != null && poi.isDirty());
boolean canSaveEntities = entities != null;
- //try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper // Purpur
+ try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper
if (canSaveChunk) {
canSaveChunk = this.saveChunk(chunk, unloading);
}
@@ -1764,7 +1764,7 @@ public final class NewChunkHolder {
this.lastEntityUnload = null;
}
}
- //} // Purpur
+ }
return executedUnloadTask | canSaveChunk | canSaveEntities | canSavePOI ? new SaveStat(executedUnloadTask || canSaveChunk, canSaveEntities, canSavePOI): null;
}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 6d6be46b30e518f9b9483100583ef318b30ee3f7..63ec2ebb71aa0e0dbb64bbce7cd3c9494e9ce2e7 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -64,7 +64,6 @@ public class GlobalConfiguration extends ConfigurationPart {
@Override
public void postProcess() {
- // Purpur - diff on change
MinecraftTimings.processConfig(this);
}
}
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 767623a35dda71d77c65602e10ef2b3f0ae743f1..27d4aa45e585842c04491839826d405d6f447f0e 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -47,9 +47,8 @@ public class PacketUtils {
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
if (listener.getConnection().isConnected()) {
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
- //try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings // Purpur
+ try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
packet.handle(listener);
- /* // Purpur
} catch (Exception exception) {
net.minecraft.network.Connection networkmanager = listener.getConnection();
String playerIP = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>"; // Paper
@@ -61,7 +60,7 @@ public class PacketUtils {
net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));
networkmanager.setReadOnly();
- } */ // Purpur
+ }
} else {
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet);
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b915e6a13a518f05d109c707142efa3946892f0c..029f4bf955e690621e3862e078f7474b6c2fb750 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -337,13 +337,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public MinecraftServer(OptionSet options, WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
super("Server");
SERVER = this; // Paper - better singleton
- //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur
- //this.profiler = this.metricsRecorder.getProfiler(); // Purpur
- /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur
+ this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
+ this.profiler = this.metricsRecorder.getProfiler();
+ this.onMetricsRecordingStopped = (methodprofilerresults) -> {
this.stopRecordingMetrics();
- };*/ // Purpur
- //this.onMetricsRecordingFinished = (path) -> { // Purpur
- //}; // Purpur
+ };
+ this.onMetricsRecordingFinished = (path) -> {
+ };
this.status = new ServerStatus();
this.random = RandomSource.create();
this.port = -1;
@@ -935,9 +935,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Paper end
// CraftBukkit end
- /*if (this.metricsRecorder.isRecording()) { // Purpur
+ if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
- }*/ // Purpur
+ }
MinecraftServer.LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing
@@ -1179,18 +1179,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Spigot end
- /*if (this.debugCommandProfilerDelayStart) { // Purpur
+ if (this.debugCommandProfilerDelayStart) {
this.debugCommandProfilerDelayStart = false;
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
- }*/ // Purpur
+ }
//MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
lastTick = curTime;
this.nextTickTime += 50L;
- //this.startMetricsRecordingTick(); // Purpur
- //this.profiler.push("tick"); // Purpur
+ this.startMetricsRecordingTick();
+ this.profiler.push("tick");
this.tickServer(this::haveTime);
- //this.profiler.popPush("nextTickWait"); // Purpur
+ this.profiler.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
// Purpur start - tps catchup
if (org.purpurmc.purpur.PurpurConfig.tpsCatchup) {
@@ -1200,8 +1200,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Purpur end - tps catchup
this.waitUntilNextTick();
- //this.profiler.pop(); // Purpur
- //this.endMetricsRecordingTick(); // Purpur
+ this.profiler.pop();
+ this.endMetricsRecordingTick();
this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
}
@@ -1362,7 +1362,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
- //this.getProfiler().incrementCounter("runTask"); // Purpur
+ this.getProfiler().incrementCounter("runTask");
super.doRunTask(ticktask);
}
@@ -1406,15 +1406,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {}
public void tickServer(BooleanSupplier shouldKeepTicking) {
- //co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper // Purpur
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
long i = Util.getNanos();
// Paper start - move oversleep into full server tick
- //isOversleep = true;MinecraftTimings.serverOversleep.startTiming(); // Purpur
+ isOversleep = true;MinecraftTimings.serverOversleep.startTiming();
this.managedBlock(() -> {
return !this.canOversleep();
});
- //isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); // Purpur
+ isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
// Paper end
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
@@ -1447,7 +1447,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (playerSaveInterval < 0) {
playerSaveInterval = autosavePeriod;
}
- //this.profiler.push("save"); // Purpur
+ this.profiler.push("save");
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
try {
this.isSaving = true;
@@ -1462,20 +1462,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.isSaving = false;
}
- //this.profiler.pop(); // Purpur
+ this.profiler.pop();
// Paper end
io.papermc.paper.util.CachedLists.reset(); // Paper
// Paper start - move executeAll() into full server tick timing
- //try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) { // Purpur
+ try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
this.runAllTasks();
- //} // Purpur
+ }
// Paper end
// Paper start
long endTime = System.nanoTime();
long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
// Paper end
- //this.profiler.push("tallying"); // Purpur
+ this.profiler.push("tallying");
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
this.averageTickTime = this.averageTickTime * 0.8F + (float) l / 1000000.0F * 0.19999999F;
@@ -1488,31 +1488,31 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end
this.frameTimer.logFrameDuration(i1 - i);
- //this.profiler.pop(); // Purpur
+ this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
- //co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper // Purpur
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
}
public void tickChildren(BooleanSupplier shouldKeepTicking) {
- //MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
- //MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper // Purpur
- //this.profiler.push("commandFunctions"); // Purpur
- //MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper
+ this.profiler.push("commandFunctions");
+ MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
this.getFunctions().tick();
- //MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper // Purpur
- //this.profiler.popPush("levels"); // Purpur
+ MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper
+ this.profiler.popPush("levels");
//Iterator iterator = this.getAllLevels().iterator(); // Paper - moved down
// CraftBukkit start
// Run tasks that are waiting on processing
- //MinecraftTimings.processQueueTimer.startTiming(); // Spigot // Purpur
+ MinecraftTimings.processQueueTimer.startTiming(); // Spigot
while (!this.processQueue.isEmpty()) {
this.processQueue.remove().run();
}
- //MinecraftTimings.processQueueTimer.stopTiming(); // Spigot // Purpur
+ MinecraftTimings.processQueueTimer.stopTiming(); // Spigot
- //MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
// Send time updates to everyone, it will get the right time from the world the player is in.
// Paper start - optimize time updates
for (final ServerLevel world : this.getAllLevels()) {
@@ -1532,10 +1532,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Paper end
- //MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
this.isIteratingOverLevels = true; // Paper
- net.minecraft.network.FriendlyByteBuf.hasItemSerializeEvent = org.purpurmc.purpur.event.packet.NetworkItemSerializeEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur
Iterator iterator = this.getAllLevels().iterator(); // Paper - move down
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
@@ -1544,28 +1543,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldserver.hasRidableMoveEvent = org.purpurmc.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
- /*this.profiler.push(() -> { // Purpur
+ this.profiler.push(() -> {
return worldserver + " " + worldserver.dimension().location();
- });*/ // Purpur
+ });
/* Drop global time updates
if (this.tickCount % 20 == 0) {
- //this.profiler.push("timeSync"); // Purpur
+ this.profiler.push("timeSync");
this.playerList.broadcastAll(new PacketPlayOutUpdateTime(worldserver.getGameTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)), worldserver.dimension());
- //this.profiler.pop(); // Purpur
+ this.profiler.pop();
}
// CraftBukkit end */
- //this.profiler.push("tick"); // Purpur
+ this.profiler.push("tick");
try {
- //worldserver.timings.doTick.startTiming(); // Spigot // Purpur
+ worldserver.timings.doTick.startTiming(); // Spigot
worldserver.tick(shouldKeepTicking);
// Paper start
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
regionManager.recalculateRegions();
}
// Paper end
- //worldserver.timings.doTick.stopTiming(); // Spigot // Purpur
+ worldserver.timings.doTick.stopTiming(); // Spigot
} catch (Throwable throwable) {
// Spigot Start
CrashReport crashreport;
@@ -1581,33 +1580,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw new ReportedException(crashreport);
}
- //this.profiler.pop(); // Purpur
- //this.profiler.pop(); // Purpur
+ this.profiler.pop();
+ this.profiler.pop();
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
}
this.isIteratingOverLevels = false; // Paper
- //this.profiler.popPush("connection"); // Purpur
- //MinecraftTimings.connectionTimer.startTiming(); // Spigot // Purpur
+ this.profiler.popPush("connection");
+ MinecraftTimings.connectionTimer.startTiming(); // Spigot
this.getConnection().tick();
- //MinecraftTimings.connectionTimer.stopTiming(); // Spigot // Purpur
- //this.profiler.popPush("players"); // Purpur
- //MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.connectionTimer.stopTiming(); // Spigot
+ this.profiler.popPush("players");
+ MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper
this.playerList.tick();
- //MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper
if (SharedConstants.IS_RUNNING_IN_IDE) {
GameTestTicker.SINGLETON.tick();
}
- //this.profiler.popPush("server gui refresh"); // Purpur
+ this.profiler.popPush("server gui refresh");
- //MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
for (int i = 0; i < this.tickables.size(); ++i) {
((Runnable) this.tickables.get(i)).run();
}
- //MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
- //this.profiler.pop(); // Purpur
+ this.profiler.pop();
}
public boolean isNetherEnabled() {
@@ -2261,7 +2260,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public ProfilerFiller getProfiler() {
- // Purpur - diff on change
return this.profiler;
}
@@ -2501,7 +2499,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end
private void startMetricsRecordingTick() {
- if (false && this.willStartRecordingMetrics) { // Purpur
+ if (this.willStartRecordingMetrics) {
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
this.executeBlocking(() -> {
this.saveDebugReport(path.resolve("server"));
@@ -2511,40 +2509,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.willStartRecordingMetrics = false;
}
- //this.profiler = SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server")); // Purpur
- //this.metricsRecorder.startTick(); // Purpur
- //this.profiler.startTick(); // Purpur
+ this.profiler = SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server"));
+ this.metricsRecorder.startTick();
+ this.profiler.startTick();
}
private void endMetricsRecordingTick() {
- //this.profiler.endTick(); // Purpur
- //this.metricsRecorder.endTick(); // Purpur
+ this.profiler.endTick();
+ this.metricsRecorder.endTick();
}
public boolean isRecordingMetrics() {
- return false; //this.metricsRecorder.isRecording(); // Purpur
+ return this.metricsRecorder.isRecording();
}
public void startRecordingMetrics(Consumer<ProfileResults> resultConsumer, Consumer<Path> dumpConsumer) {
- /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur
+ this.onMetricsRecordingStopped = (methodprofilerresults) -> {
this.stopRecordingMetrics();
resultConsumer.accept(methodprofilerresults);
};
this.onMetricsRecordingFinished = dumpConsumer;
- this.willStartRecordingMetrics = true;*/ // Purpur
+ this.willStartRecordingMetrics = true;
}
public void stopRecordingMetrics() {
- //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur
+ this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
}
public void finishRecordingMetrics() {
- //this.metricsRecorder.end(); // Purpur
+ this.metricsRecorder.end();
}
public void cancelRecordingMetrics() {
- //this.metricsRecorder.cancel(); // Purpur
- //this.profiler = this.metricsRecorder.getProfiler(); // Purpur
+ this.metricsRecorder.cancel();
+ this.profiler = this.metricsRecorder.getProfiler();
}
public Path getWorldPath(LevelResource worldSavePath) {
@@ -2593,15 +2591,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public boolean isTimeProfilerRunning() {
- return false; //this.debugCommandProfilerDelayStart || this.debugCommandProfiler != null; // Purpur
+ return this.debugCommandProfilerDelayStart || this.debugCommandProfiler != null;
}
public void startTimeProfiler() {
- //this.debugCommandProfilerDelayStart = true; // Purpur
+ this.debugCommandProfilerDelayStart = true;
}
public ProfileResults stopTimeProfiler() {
- if (true || this.debugCommandProfiler == null) { // Purpur
+ if (this.debugCommandProfiler == null) {
return EmptyProfileResults.EMPTY;
} else {
ProfileResults methodprofilerresults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount);
@@ -2774,7 +2772,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return;
}
- //co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming(); // Purpur
+ co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming();
try {
for (;;) {
boolean moreTasks = this.tickMidTickTasks();
@@ -2801,7 +2799,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
} finally {
- //co.aikar.timings.MinecraftTimings.midTickChunkTasks.stopTiming(); // Purpur
+ co.aikar.timings.MinecraftTimings.midTickChunkTasks.stopTiming();
}
}
// Paper end - execute chunk tasks mid tick
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
index 8645313e646e6d5278e285f7449447761d7aae29..848f2ff87ff7ae87143ed30da7abf4919a886ecb 100644
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
@@ -88,7 +88,7 @@ public class ServerFunctionManager {
} else {
int i;
- try /*(co.aikar.timings.Timing timing = function.getTiming().startTiming())*/ { // Paper // Purpur
+ try (co.aikar.timings.Timing timing = function.getTiming().startTiming()) { // Paper
this.context = new ServerFunctionManager.ExecutionContext(tracer);
i = this.context.runTopCommand(function, source);
} finally {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index c2dab0da201010395b9367c8812115b34176fa36..f664f4e5a49ade081cd53c71e0760e344a39468a 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -529,7 +529,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
public void handleConsoleInputs() {
- //MinecraftTimings.serverCommandTimer.startTiming(); // Spigot // Purpur
+ MinecraftTimings.serverCommandTimer.startTiming(); // Spigot
// Paper start - use proper queue
ConsoleInput servercommand;
while ((servercommand = this.serverCommandQueue.poll()) != null) {
@@ -546,7 +546,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// CraftBukkit end
}
- //MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot // Purpur
+ MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot
}
@Override
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 7276a5b8d22924240d78f732d53d678c7468bcb9..b3516a1b13b325385c4cfddb481c6e3eb6805ae1 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -618,20 +618,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick(BooleanSupplier shouldKeepTicking) {
- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.level.getProfiler();
- //try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper // Purpur
- //gameprofilerfiller.push("poi"); // Purpur
+ try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper
+ gameprofilerfiller.push("poi");
this.poiManager.tick(shouldKeepTicking);
- //} // Paper // Purpur
- //gameprofilerfiller.popPush("chunk_unload"); // Purpur
+ } // Paper
+ gameprofilerfiller.popPush("chunk_unload");
if (!this.level.noSave()) {
- //try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper // Purpur
+ try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper
this.processUnloads(shouldKeepTicking);
- //} // Paper // Purpur
+ } // Paper
}
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
}
public boolean hasWork() {
@@ -1250,24 +1250,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper start - optimised tracker
private final void processTrackQueue() {
- //this.level.timings.tracker1.startTiming(); // Purpur
+ this.level.timings.tracker1.startTiming();
try {
for (TrackedEntity tracker : this.entityMap.values()) {
// update tracker entry
tracker.updatePlayers(tracker.entity.getPlayersInTrackRange());
}
} finally {
- //this.level.timings.tracker1.stopTiming(); // Purpur
+ this.level.timings.tracker1.stopTiming();
}
- //this.level.timings.tracker2.startTiming(); // Purpur
+ this.level.timings.tracker2.startTiming();
try {
for (TrackedEntity tracker : this.entityMap.values()) {
tracker.serverEntity.sendChanges();
}
} finally {
- //this.level.timings.tracker2.stopTiming(); // Purpur
+ this.level.timings.tracker2.stopTiming();
}
}
// Paper end - optimised tracker
@@ -1282,7 +1282,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator();
- //level.timings.tracker1.startTiming(); // Paper // Purpur
+ level.timings.tracker1.startTiming(); // Paper
ChunkMap.TrackedEntity playerchunkmap_entitytracker;
@@ -1307,17 +1307,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
playerchunkmap_entitytracker.serverEntity.sendChanges();
}
}
- //level.timings.tracker1.stopTiming(); // Paper // Purpur
+ level.timings.tracker1.stopTiming(); // Paper
if (!list.isEmpty()) {
objectiterator = this.entityMap.values().iterator();
- //level.timings.tracker2.startTiming(); // Paper // Purpur
+ level.timings.tracker2.startTiming(); // Paper
while (objectiterator.hasNext()) {
playerchunkmap_entitytracker = (ChunkMap.TrackedEntity) objectiterator.next();
playerchunkmap_entitytracker.updatePlayers(list);
}
- //level.timings.tracker2.stopTiming(); // Paper // Purpur
+ level.timings.tracker2.stopTiming(); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 105cdab3a1c912299dbcfb670ace810b9202731c..ca84eddbdb1e198b899750e5f6b3eafd25ce970f 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -428,16 +428,16 @@ public class ServerChunkCache extends ChunkSource {
return ifLoaded;
}
// Paper end
- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.level.getProfiler();
- //gameprofilerfiller.incrementCounter("getChunk"); // Purpur
+ gameprofilerfiller.incrementCounter("getChunk");
long k = ChunkPos.asLong(x, z);
ChunkAccess ichunkaccess;
// Paper - rewrite chunk system - there are no correct callbacks to remove items from cache in the new chunk system
- //gameprofilerfiller.incrementCounter("getChunkCacheMiss"); // Purpur
+ gameprofilerfiller.incrementCounter("getChunkCacheMiss");
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create, true); // Paper
ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor;
@@ -447,10 +447,10 @@ public class ServerChunkCache extends ChunkSource {
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.pushChunkWait(this.level, x1, z1); // Paper - rewrite chunk system
// Paper end
com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - sync load info
- //this.level.timings.syncChunkLoad.startTiming(); // Paper // Purpur
+ this.level.timings.syncChunkLoad.startTiming(); // Paper
chunkproviderserver_b.managedBlock(completablefuture::isDone);
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system
- //this.level.timings.syncChunkLoad.stopTiming(); // Paper // Purpur
+ this.level.timings.syncChunkLoad.stopTiming(); // Paper
} // Paper
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
return ichunkaccess1;
@@ -598,17 +598,17 @@ public class ServerChunkCache extends ChunkSource {
public void save(boolean flush) {
this.runDistanceManagerUpdates();
- //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur
+ try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings
this.chunkMap.saveAllChunks(flush);
- //} // Paper - Timings // Purpur
+ } // Paper - Timings
}
// Paper start - duplicate save, but call incremental
public void saveIncrementally() {
this.runDistanceManagerUpdates();
- //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur
+ try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings
this.chunkMap.saveIncrementally();
- //} // Paper - Timings // Purpur
+ } // Paper - Timings
}
// Paper end
@@ -625,36 +625,36 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - modelled on below
public void purgeUnload() {
if (true) return; // Paper - tickets will be removed later, this behavior isn't really well accounted for by the chunk system
- //this.level.getProfiler().push("purge"); // Purpur
+ this.level.getProfiler().push("purge");
this.distanceManager.purgeStaleTickets();
this.runDistanceManagerUpdates();
- //this.level.getProfiler().popPush("unload"); // Purpur
+ this.level.getProfiler().popPush("unload");
this.chunkMap.tick(() -> true);
- //this.level.getProfiler().pop(); // Purpur
+ this.level.getProfiler().pop();
this.clearCache();
}
// CraftBukkit end
@Override
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
- //this.level.getProfiler().push("purge"); // Purpur
- //this.level.timings.doChunkMap.startTiming(); // Spigot // Purpur
+ this.level.getProfiler().push("purge");
+ this.level.timings.doChunkMap.startTiming(); // Spigot
this.distanceManager.purgeStaleTickets();
this.runDistanceManagerUpdates();
- //this.level.timings.doChunkMap.stopTiming(); // Spigot // Purpur
- //this.level.getProfiler().popPush("chunks"); // Purpur
+ this.level.timings.doChunkMap.stopTiming(); // Spigot
+ this.level.getProfiler().popPush("chunks");
if (tickChunks) {
- //this.level.timings.chunks.startTiming(); // Paper - timings // Purpur
+ this.level.timings.chunks.startTiming(); // Paper - timings
this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes
this.tickChunks();
- //this.level.timings.chunks.stopTiming(); // Paper - timings // Purpur
+ this.level.timings.chunks.stopTiming(); // Paper - timings
}
- //this.level.timings.doChunkUnload.startTiming(); // Spigot // Purpur
- //this.level.getProfiler().popPush("unload"); // Purpur
+ this.level.timings.doChunkUnload.startTiming(); // Spigot
+ this.level.getProfiler().popPush("unload");
this.chunkMap.tick(shouldKeepTicking);
- //this.level.timings.doChunkUnload.stopTiming(); // Spigot // Purpur
- //this.level.getProfiler().pop(); // Purpur
+ this.level.timings.doChunkUnload.stopTiming(); // Spigot
+ this.level.getProfiler().pop();
this.clearCache();
}
@@ -700,14 +700,14 @@ public class ServerChunkCache extends ChunkSource {
}
// Paper end - optimize isOutisdeRange
LevelData worlddata = this.level.getLevelData();
- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.level.getProfiler();
- //gameprofilerfiller.push("pollingChunks"); // Purpur
+ gameprofilerfiller.push("pollingChunks");
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
- //gameprofilerfiller.push("naturalSpawnCount"); // Purpur
- //this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur
+ gameprofilerfiller.push("naturalSpawnCount");
+ this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning
NaturalSpawner.SpawnState spawnercreature_d; // moved down
@@ -721,16 +721,16 @@ public class ServerChunkCache extends ChunkSource {
spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, this.chunkMap.playerMobDistanceMap == null ? new LocalMobCapCalculator(this.chunkMap) : null, false);
}
// Paper end
- //this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur
+ this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.lastSpawnState = spawnercreature_d;
- //gameprofilerfiller.popPush("filteringLoadedChunks"); // Purpur
+ gameprofilerfiller.popPush("filteringLoadedChunks");
// Paper - moved down
- //this.level.timings.chunkTicks.startTiming(); // Paper // Purpur
+ this.level.timings.chunkTicks.startTiming(); // Paper
// Paper - moved down
- //gameprofilerfiller.popPush("spawnAndTick"); // Purpur
+ gameprofilerfiller.popPush("spawnAndTick");
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
// Paper - only shuffle if per-player mob spawning is disabled
@@ -780,17 +780,17 @@ public class ServerChunkCache extends ChunkSource {
}
}
// Paper end - optimise chunk tick iteration
- //this.level.timings.chunkTicks.stopTiming(); // Paper // Purpur
- //gameprofilerfiller.popPush("customSpawners"); // Purpur
+ this.level.timings.chunkTicks.stopTiming(); // Paper
+ gameprofilerfiller.popPush("customSpawners");
if (flag2) {
- //try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings // Purpur
+ try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
- //} // Paper - timings // Purpur
+ } // Paper - timings
}
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
// Paper start - use set of chunks requiring updates, rather than iterating every single one loaded
- //gameprofilerfiller.popPush("broadcast"); // Purpur
- //this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur
+ gameprofilerfiller.popPush("broadcast");
+ this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
this.chunkMap.needsChangeBroadcasting.clear();
@@ -802,8 +802,8 @@ public class ServerChunkCache extends ChunkSource {
}
}
}
- //this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing // Purpur
- //gameprofilerfiller.pop(); // Purpur
+ this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
+ gameprofilerfiller.pop();
// Paper end - use set of chunks requiring updates, rather than iterating every single one loaded
// Paper start - controlled flush for entity tracker packets
List<net.minecraft.network.Connection> disabledFlushes = new java.util.ArrayList<>(this.level.players.size());
@@ -994,7 +994,7 @@ public class ServerChunkCache extends ChunkSource {
@Override
protected void doRunTask(Runnable task) {
- //ServerChunkCache.this.level.getProfiler().incrementCounter("runTask"); // Purpur
+ ServerChunkCache.this.level.getProfiler().incrementCounter("runTask");
super.doRunTask(task);
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e21559ebc4d5ffcf10fc50f5bcc31ccff3b8394f..8fd3511d484cfd2b56238530aea95c84effcd1f1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -656,12 +656,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise checkDespawn
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
this.handlingTick = true;
- //gameprofilerfiller.push("world border"); // Purpur
+ gameprofilerfiller.push("world border");
this.getWorldBorder().tick();
- //gameprofilerfiller.popPush("weather"); // Purpur
+ gameprofilerfiller.popPush("weather");
this.advanceWeatherCycle();
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
long j;
@@ -688,32 +688,32 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.updateSkyBrightness();
this.tickTime();
- //gameprofilerfiller.popPush("tickPending"); // Purpur
- //timings.scheduledBlocks.startTiming(); // Paper // Purpur
+ gameprofilerfiller.popPush("tickPending");
+ timings.scheduledBlocks.startTiming(); // Paper
if (!this.isDebug()) {
j = this.getGameTime();
- //gameprofilerfiller.push("blockTicks"); // Purpur
+ gameprofilerfiller.push("blockTicks");
this.blockTicks.tick(j, 65536, this::tickBlock);
- //gameprofilerfiller.popPush("fluidTicks"); // Purpur
+ gameprofilerfiller.popPush("fluidTicks");
this.fluidTicks.tick(j, 65536, this::tickFluid);
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
}
- //timings.scheduledBlocks.stopTiming(); // Paper // Purpur
+ timings.scheduledBlocks.stopTiming(); // Paper
- //gameprofilerfiller.popPush("raid"); // Purpur
- //this.timings.raids.startTiming(); // Paper - timings // Purpur
+ gameprofilerfiller.popPush("raid");
+ this.timings.raids.startTiming(); // Paper - timings
this.raids.tick();
- //this.timings.raids.stopTiming(); // Paper - timings // Purpur
- //gameprofilerfiller.popPush("chunkSource"); // Purpur
- //this.timings.chunkProviderTick.startTiming(); // Paper - timings // Purpur
+ this.timings.raids.stopTiming(); // Paper - timings
+ gameprofilerfiller.popPush("chunkSource");
+ this.timings.chunkProviderTick.startTiming(); // Paper - timings
this.getChunkSource().tick(shouldKeepTicking, true);
- //this.timings.chunkProviderTick.stopTiming(); // Paper - timings // Purpur
- //gameprofilerfiller.popPush("blockEvents"); // Purpur
- //timings.doSounds.startTiming(); // Spigot // Purpur
+ this.timings.chunkProviderTick.stopTiming(); // Paper - timings
+ gameprofilerfiller.popPush("blockEvents");
+ timings.doSounds.startTiming(); // Spigot
this.runBlockEvents();
- //timings.doSounds.stopTiming(); // Spigot // Purpur
+ timings.doSounds.stopTiming(); // Spigot
this.handlingTick = false;
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
if (flag) {
@@ -721,24 +721,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
if (flag || this.emptyTime++ < 300) {
- //gameprofilerfiller.push("entities"); // Purpur
- //timings.tickEntities.startTiming(); // Spigot // Purpur
+ gameprofilerfiller.push("entities");
+ timings.tickEntities.startTiming(); // Spigot
if (this.dragonFight != null) {
- //gameprofilerfiller.push("dragonFight"); // Purpur
+ gameprofilerfiller.push("dragonFight");
this.dragonFight.tick();
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
}
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
- //timings.entityTick.startTiming(); // Spigot // Purpur
+ timings.entityTick.startTiming(); // Spigot
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
entity.discard();
} else {
- //gameprofilerfiller.push("checkDespawn"); // Purpur
+ gameprofilerfiller.push("checkDespawn");
entity.checkDespawn();
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list
Entity entity1 = entity.getVehicle();
@@ -750,21 +750,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.stopRiding();
}
- //gameprofilerfiller.push("tick"); // Purpur
+ gameprofilerfiller.push("tick");
this.guardEntityTick(this::tickNonPassenger, entity);
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
}
}
}
});
- //timings.entityTick.stopTiming(); // Spigot // Purpur
- //timings.tickEntities.stopTiming(); // Spigot // Purpur
- //gameprofilerfiller.pop(); // Purpur
+ timings.entityTick.stopTiming(); // Spigot
+ timings.tickEntities.stopTiming(); // Spigot
+ gameprofilerfiller.pop();
this.tickBlockEntities();
}
- //gameprofilerfiller.push("entityManagement"); // Purpur
+ gameprofilerfiller.push("entityManagement");
//this.entityManager.tick(); // Paper - rewrite chunk system
+ gameprofilerfiller.pop();
}
@Override
@@ -844,9 +845,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
boolean flag = this.isRaining();
int j = chunkcoordintpair.getMinBlockX();
int k = chunkcoordintpair.getMinBlockZ();
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
- //gameprofilerfiller.push("thunder"); // Purpur
+ gameprofilerfiller.push("thunder");
final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder
@@ -884,7 +885,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
- //gameprofilerfiller.popPush("iceandsnow"); // Purpur
+ gameprofilerfiller.popPush("iceandsnow");
int l;
if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow
@@ -936,8 +937,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
// Paper start - optimise random block ticking
- //gameprofilerfiller.popPush("randomTick"); // Purpur
- //timings.chunkTicksBlocks.startTiming(); // Paper // Purpur
+ gameprofilerfiller.popPush("randomTick");
+ timings.chunkTicksBlocks.startTiming(); // Paper
if (randomTickSpeed > 0) {
LevelChunkSection[] sections = chunk.getSections();
int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
@@ -971,8 +972,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise random block ticking
- //timings.chunkTicksBlocks.stopTiming(); // Paper // Purpur
- //gameprofilerfiller.pop(); // Purpur
+ timings.chunkTicksBlocks.stopTiming(); // Paper
+ gameprofilerfiller.pop();
}
public Optional<BlockPos> findLightningRod(BlockPos pos) {
@@ -1264,24 +1265,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot end
// Paper start- timings
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity);
- //timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper // Purpur
- //try { // Purpur
+ timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper
+ try {
// Paper end - timings
entity.setOldPosAndRot();
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
++entity.tickCount;
- /*this.getProfiler().push(() -> { // Purpur
+ this.getProfiler().push(() -> {
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
- });*/ // Purpur
- //gameprofilerfiller.incrementCounter("tickNonPassenger"); // Purpur
+ });
+ gameprofilerfiller.incrementCounter("tickNonPassenger");
if (isActive) { // Paper - EAR 2
TimingHistory.activatedEntityTicks++;
entity.tick();
entity.postTick(); // CraftBukkit
} else { entity.inactiveTick(); } // Paper - EAR 2
- //this.getProfiler().pop(); // Purpur
- //} finally { timer.stopTiming(); } // Paper - timings // Purpur
+ this.getProfiler().pop();
+ } finally { timer.stopTiming(); } // Paper - timings
Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) {
@@ -1304,17 +1305,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
// Paper - EAR 2
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
- //co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper // Purpur
- //try { // Purpur
+ co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper
+ try {
// Paper end
passenger.setOldPosAndRot();
++passenger.tickCount;
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
- /*gameprofilerfiller.push(() -> { // Purpur
+ gameprofilerfiller.push(() -> {
return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
- });*/ // Purpur
- //gameprofilerfiller.incrementCounter("tickPassenger"); // Purpur
+ });
+ gameprofilerfiller.incrementCounter("tickPassenger");
// Paper start - EAR 2
if (isActive) {
passenger.rideTick();
@@ -1326,7 +1327,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
vehicle.positionRider(passenger);
}
// Paper end - EAR 2
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator();
while (iterator.hasNext()) {
@@ -1335,7 +1336,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2);
}
- //} finally { timer.stopTiming(); }// Paper - EAR2 timings // Purpur
+ } finally { timer.stopTiming(); }// Paper - EAR2 timings
}
} else {
passenger.stopRiding();
@@ -1355,14 +1356,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld()));
}
- //try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) { // Purpur
+ try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) {
if (doFull) {
this.saveLevelData();
}
- //this.timings.worldSaveChunks.startTiming(); // Paper // Purpur
+ this.timings.worldSaveChunks.startTiming(); // Paper
if (!this.noSave()) chunkproviderserver.saveIncrementally();
- //this.timings.worldSaveChunks.stopTiming(); // Paper // Purpur
+ this.timings.worldSaveChunks.stopTiming(); // Paper
// Copied from save()
// CraftBukkit start - moved from MinecraftServer.saveChunks
@@ -1374,7 +1375,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
}
// CraftBukkit end
- //} // Purpur
+ }
}
// Paper end
@@ -1388,7 +1389,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!savingDisabled) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
- //try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper // Purpur // Purpur
+ try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper
if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
@@ -1398,11 +1399,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
progressListener.progressStage(Component.translatable("menu.savingChunks"));
}
- //timings.worldSaveChunks.startTiming(); // Paper // Purpur
+ timings.worldSaveChunks.startTiming(); // Paper
if (!close) chunkproviderserver.save(flush); // Paper - rewrite chunk system
if (close) chunkproviderserver.close(true); // Paper - rewrite chunk system
- //timings.worldSaveChunks.stopTiming(); // Paper // Purpur
- //}// Paper // Purpur
+ timings.worldSaveChunks.stopTiming(); // Paper
+ }// Paper
// Paper - rewrite chunk system - entity saving moved into ChunkHolder
} else if (close) { chunkproviderserver.close(false); } // Paper - rewrite chunk system
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e69348724dc1b98a91f93af18dde6e6231068b61..45bdc5afa8b51ef381ac3c41c57cf0ad271658d0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2586,7 +2586,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
}
// Paper End
- //co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper // Purpur
+ co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
@@ -2596,7 +2596,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled()) {
- //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur
+ co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
return;
}
@@ -2609,7 +2609,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return;
} finally {
- //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur
+ co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 9cfe4f2ab57f6d17a64eda2c48fb59ab7aa14367..23cea7dd67dd1890a8fd34c294d140b30e89f59c 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1297,7 +1297,7 @@ public abstract class PlayerList {
public void saveAll(int interval) {
io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
- //MinecraftTimings.savePlayers.startTiming(); // Paper // Purpur
+ MinecraftTimings.savePlayers.startTiming(); // Paper
int numSaved = 0;
long now = MinecraftServer.currentTick;
for (int i = 0; i < this.players.size(); ++i) {
@@ -1308,7 +1308,7 @@ public abstract class PlayerList {
}
// Paper end
}
- //MinecraftTimings.savePlayers.stopTiming(); // Paper // Purpur
+ MinecraftTimings.savePlayers.stopTiming(); // Paper
return null; }); // Paper - ensure main
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
index 651c156dc8a5aad04d461add02e22147af657d07..57ef7fbba3028c28231abf7b7ae78aa019323536 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
@@ -58,9 +58,9 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
this.status = Behavior.Status.RUNNING;
int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration);
this.endTimestamp = time + (long)i;
- //this.timing.startTiming(); // Paper - behavior timings // Purpur
+ this.timing.startTiming(); // Paper - behavior timings
this.start(world, entity, time);
- //this.timing.stopTiming(); // Paper - behavior timings // Purpur
+ this.timing.stopTiming(); // Paper - behavior timings
return true;
} else {
return false;
@@ -72,13 +72,13 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
@Override
public final void tickOrStop(ServerLevel world, E entity, long time) {
- //this.timing.startTiming(); // Paper - behavior timings // Purpur
+ this.timing.startTiming(); // Paper - behavior timings
if (!this.timedOut(time) && this.canStillUse(world, entity, time)) {
this.tick(world, entity, time);
} else {
this.doStop(world, entity, time);
}
- //this.timing.stopTiming(); // Paper - behavior timings // Purpur
+ this.timing.stopTiming(); // Paper - behavior timings
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
index 7094701d213c73ba47ace806962244c10fdf4dda..fcdb9bde8e1605e30dde3e580491522d4b62cdc0 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
@@ -46,10 +46,10 @@ public abstract class Sensor<E extends LivingEntity> {
if (--this.timeToTick <= 0L) {
// Paper start - configurable sensor tick rate and timings
this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate);
- //this.timing.startTiming(); // Purpur
+ this.timing.startTiming();
// Paper end
this.doTick(world, entity);
- //this.timing.stopTiming(); // Paper - sensor timings // Purpur
+ this.timing.stopTiming(); // Paper - sensor timings
}
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 3778ad438b3a5f6cdbc465c7356bf9e11340753e..730a6e8bac4436a62c4ef5a122f55fc92432ae6a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -608,9 +608,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
BlockState iblockdata2 = this.getBlockState(pos);
if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock(this, pos) != iblockdata1.getLightBlock(this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
- //this.getProfiler().push("queueCheckLight"); // Purpur
+ this.getProfiler().push("queueCheckLight");
this.getChunkSource().getLightEngine().checkBlock(pos);
- //this.getProfiler().pop(); // Purpur
+ this.getProfiler().pop();
}
/*
@@ -909,18 +909,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
protected void tickBlockEntities() {
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
- //gameprofilerfiller.push("blockEntities"); // Purpur
- //timings.tileEntityPending.startTiming(); // Spigot // Purpur
+ gameprofilerfiller.push("blockEntities");
+ timings.tileEntityPending.startTiming(); // Spigot
this.tickingBlockEntities = true;
if (!this.pendingBlockEntityTickers.isEmpty()) {
this.blockEntityTickers.addAll(this.pendingBlockEntityTickers);
this.pendingBlockEntityTickers.clear();
}
- //timings.tileEntityPending.stopTiming(); // Spigot // Purpur
+ timings.tileEntityPending.stopTiming(); // Spigot
- //timings.tileEntityTick.startTiming(); // Spigot // Purpur
+ timings.tileEntityTick.startTiming(); // Spigot
// Spigot start
// Iterator iterator = this.blockEntityTickers.iterator();
int tilesThisCycle = 0;
@@ -953,10 +953,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
this.blockEntityTickers.removeAll(toRemove);
- //timings.tileEntityTick.stopTiming(); // Spigot // Purpur
+ timings.tileEntityTick.stopTiming(); // Spigot
this.tickingBlockEntities = false;
co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
spigotConfig.currentPrimedTnt = 0; // Spigot
}
@@ -1149,7 +1149,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
- //this.getProfiler().incrementCounter("getEntities"); // Purpur
+ this.getProfiler().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList();
((ServerLevel)this).getEntityLookup().getEntities(except, box, list, predicate); // Paper - optimise this call
return list;
@@ -1168,7 +1168,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
public <T extends Entity> void getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate, List<? super T> result, int limit) {
- //this.getProfiler().incrementCounter("getEntities"); // Purpur
+ this.getProfiler().incrementCounter("getEntities");
// Paper start - optimise this call
//TODO use limit
if (filter instanceof net.minecraft.world.entity.EntityType entityTypeTest) {
@@ -1497,7 +1497,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
public ProfilerFiller getProfiler() {
- // Purpur - diff on change
return (ProfilerFiller) this.profiler.get();
}
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index decf30b590658a627d47cb688531ec1cc24ba001..01b21f520ef1c834b9bafc3de85c1fa4fcf539d6 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -132,8 +132,8 @@ public final class NaturalSpawner {
}
public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn) {
- //world.getProfiler().push("spawner"); // Purpur
- //world.timings.mobSpawn.startTiming(); // Spigot // Purpur
+ world.getProfiler().push("spawner");
+ world.timings.mobSpawn.startTiming(); // Spigot
MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES;
int i = aenumcreaturetype.length;
@@ -188,8 +188,8 @@ public final class NaturalSpawner {
}
}
- //world.timings.mobSpawn.stopTiming(); // Spigot // Purpur
- //world.getProfiler().pop(); // Purpur
+ world.timings.mobSpawn.stopTiming(); // Spigot
+ world.getProfiler().pop();
}
// Paper start
@@ -260,7 +260,7 @@ public final class NaturalSpawner {
blockposition_mutableblockposition.set(l, i, i1);
double d0 = (double) l + 0.5D;
double d1 = (double) i1 + 0.5D;
- Player entityhuman = (chunk instanceof LevelChunk) ? ((LevelChunk)chunk).findNearestPlayer(d0, i, d1, 576.0D, world.purpurConfig.mobSpawningIgnoreCreativePlayers ? net.minecraft.world.entity.EntitySelector.NO_CREATIVE_OR_SPECTATOR : net.minecraft.world.entity.EntitySelector.NO_SPECTATORS) : world.getNearestPlayer(d0, (double) i, d1, -1.0D, world.purpurConfig.mobSpawningIgnoreCreativePlayers); // Paper - use chunk's player cache to optimize search in range // Purpur
+ Player entityhuman = (chunk instanceof LevelChunk) ? ((LevelChunk)chunk).findNearestPlayer(d0, i, d1, 576.0D, net.minecraft.world.entity.EntitySelector.NO_SPECTATORS) : world.getNearestPlayer(d0, (double) i, d1, -1.0D, false); // Paper - use chunk's player cache to optimize search in range
if (entityhuman != null) {
double d2 = entityhuman.distanceToSqr(d0, (double) i, d1);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 2850b4fac2bf28b751cd6412e2effb99c60a3d74..28e4b302284f955a73e75d0f4276d55fb51826f5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -53,10 +53,6 @@ import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.ticks.LevelChunkTicks;
import net.minecraft.world.ticks.TickContainerAccess;
import org.slf4j.Logger;
-// KeYi start
-import cc.keyimc.keyi.utils.FastRandom;
-import java.util.Random; // KeYi
-// KeYi end
public class LevelChunk extends ChunkAccess {
@@ -921,9 +917,9 @@ public class LevelChunk extends ChunkAccess {
this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system
if (this.needsDecoration) {
- //try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper // Purpur
+ try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper
this.needsDecoration = false;
- Random random = new FastRandom();
+ java.util.Random random = new java.util.Random();
random.setSeed(this.level.getSeed());
long xRand = random.nextLong() / 2L * 2L + 1L;
long zRand = random.nextLong() / 2L * 2L + 1L;
@@ -941,7 +937,7 @@ public class LevelChunk extends ChunkAccess {
}
}
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk));
- //} // Paper // Purpur
+ } // Paper
}
}
}
@@ -1298,10 +1294,10 @@ public class LevelChunk extends ChunkAccess {
if (LevelChunk.this.isTicking(blockposition)) {
try {
- //ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler();
- //gameprofilerfiller.push(this::getType); // Purpur
- //this.blockEntity.tickTimer.startTiming(); // Spigot // Purpur
+ gameprofilerfiller.push(this::getType);
+ this.blockEntity.tickTimer.startTiming(); // Spigot
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
if (this.blockEntity.getType().isValid(iblockdata)) {
@@ -1312,7 +1308,7 @@ public class LevelChunk extends ChunkAccess {
LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
}
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
} catch (Throwable throwable) {
if (throwable instanceof ThreadDeath) throw throwable; // Paper
// Paper start - Prevent tile entity and entity crashes
@@ -1323,7 +1319,7 @@ public class LevelChunk extends ChunkAccess {
// Paper end
// Spigot start
} finally {
- //this.blockEntity.tickTimer.stopTiming(); // Purpur
+ this.blockEntity.tickTimer.stopTiming();
// Spigot end
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 5402098dce0d64d3dceea51f248d7d366850a74f..d1526ed7197b883e1d1f07baf285bf5eef4d20d5 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -516,10 +516,10 @@ public class CraftScheduler implements BukkitScheduler {
this.runners.remove(task.getTaskId());
}
}
- //MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper // Purpur
+ MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper
this.pending.addAll(temp);
temp.clear();
- //MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper // Purpur
+ MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper
//this.debugHead = this.debugHead.getNextHead(currentTick); // Paper
}
@@ -563,7 +563,7 @@ public class CraftScheduler implements BukkitScheduler {
}
void parsePending() { // Paper
- //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper // Purpur
+ if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper
CraftTask head = this.head;
CraftTask task = head.getNext();
CraftTask lastTask = head;
@@ -582,7 +582,7 @@ public class CraftScheduler implements BukkitScheduler {
task.setNext(null);
}
this.head = lastTask;
- //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper // Purpur
+ if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper
}
private boolean isReady(final int currentTick) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
index 4f1cf281c4bf68c37982d390da8779dea78dab18..3f45bab0e9f7b3697e6d9d1092a1e6e579f7066f 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -96,13 +96,13 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@Override
public void run() {
- //try (Timing ignored = timings.startTiming()) { // Paper // Purpur
+ try (Timing ignored = timings.startTiming()) { // Paper
if (this.rTask != null) {
this.rTask.run();
} else {
this.cTask.accept(this);
}
- //} // Paper // Purpur
+ } // Paper
}
long getCreatedAt() {
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
index a6e9e503a496c18e2501b03ec84f4600c134a50c..138407c2d4b0bc55ddb9aac5d2aa3edadda090fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
@@ -115,7 +115,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
public void getScoreboardScores(ObjectiveCriteria criteria, String name, Consumer<Score> consumer) {
// Paper start - add timings for scoreboard search
// plugins leaking scoreboards will make this very expensive, let server owners debug it easily
- //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync(); // Purpur
+ co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync();
try {
// Paper end - add timings for scoreboard search
for (CraftScoreboard scoreboard : this.scoreboards) {
@@ -123,7 +123,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
board.forAllObjectives(criteria, name, (score) -> consumer.accept(score));
}
} finally { // Paper start - add timings for scoreboard search
- //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync(); // Purpur
+ co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync();
}
// Paper end - add timings for scoreboard search
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 43d962f634c25da159c4935a3c5c8994a3a4930e..3783186d0c3f2f7b241d38f8ee011e8a5c172980 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -166,7 +166,7 @@ public class ActivationRange
*/
public static void activateEntities(Level world)
{
- //MinecraftTimings.entityActivationCheckTimer.startTiming(); // Purpur
+ MinecraftTimings.entityActivationCheckTimer.startTiming();
final int miscActivationRange = world.spigotConfig.miscActivationRange;
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
@@ -221,7 +221,7 @@ public class ActivationRange
}
// Paper end
}
- //MinecraftTimings.entityActivationCheckTimer.stopTiming(); // Purpur
+ MinecraftTimings.entityActivationCheckTimer.stopTiming();
}
/**