mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 07:17:46 +01:00
Add server oversleep to timings (#2509)
Now everything except waiting for the next tick should be included in timings
This commit is contained in:
parent
13d4dd046d
commit
98854cdf4d
@ -429,7 +429,7 @@ index 1f6a126329..6d278a0da5 100644
|
||||
* Calculates distance between 2 entities
|
||||
* @param e1
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 8fcffc9fa3..32a9e54d0a 100644
|
||||
index 6c9a43d66b..6e6c662f95 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
@ -16,7 +16,7 @@ handling that should have been handled synchronously will be handled
|
||||
synchronously when the server gets shut down.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 35c5d38c2..c70ab3caf 100644
|
||||
index 24dccfb7a1..ee02001700 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@ -29,7 +29,7 @@ index 35c5d38c2..c70ab3caf 100644
|
||||
|
||||
@Deprecated
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index b89486beb..7a8ab7d40 100644
|
||||
index b89486beb1..7a8ab7d401 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
|
@ -177,7 +177,7 @@ index 0000000000..a85466bc7e
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 32a9e54d0a..37353b29da 100644
|
||||
index 6e6c662f95..8d2be704f9 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -32,7 +32,7 @@ index ef392f5fe8..227fe073fd 100644
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 55d10058f5..fe50d4ff71 100644
|
||||
index f56edde789..34be67417d 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@ -66,7 +66,7 @@ index c40777ecb8..cb5515dc3b 100644
|
||||
this.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index ee74a677a3..81f8373985 100644
|
||||
index 0c7fe7c55e..362cb6bf8b 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
@ -47,7 +47,7 @@ index c69a067ef1..1e23d77e72 100644
|
||||
itemstack.d(this.C());
|
||||
if (this.tag != null) {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 2acb71fa8a..0d690fc8e1 100644
|
||||
index 6f410ca921..c075780674 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
@ -8,7 +8,7 @@ the updates per world, so that we can re-use the same packet
|
||||
object for every player unless they have per-player time enabled.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index a5447c6501..aec871dd24 100644
|
||||
index 40260dbd48..a7b63ab421 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
@ -123,7 +123,7 @@ index cdd8939504..bd6a0bd16b 100644
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 6594138f35..55d10058f5 100644
|
||||
index 64c961e5b5..f56edde789 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
@ -6,11 +6,11 @@ Subject: [PATCH] Server Tick Events
|
||||
Fires event at start and end of a server tick
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index aec871dd24..35c5d38c21 100644
|
||||
index a7b63ab421..24dccfb7a1 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
|
||||
// Paper end
|
||||
this.slackActivityAccountant.tickStarted(); // Spigot
|
||||
long i = SystemUtils.getMonotonicNanos();
|
||||
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.ticks+1).callEvent(); // Paper
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java
|
||||
index 3f35a28b..cf00f35a 100644
|
||||
index 3f35a28ba1..cf00f35a5b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EULA.java
|
||||
+++ b/src/main/java/net/minecraft/server/EULA.java
|
||||
@@ -0,0 +0,0 @@ public class EULA {
|
||||
@ -19,7 +19,7 @@ index 3f35a28b..cf00f35a 100644
|
||||
throwable = throwable1;
|
||||
throw throwable1;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index bc0e483a..d7c00066 100644
|
||||
index c76f262db9..11048c37f1 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@ -32,7 +32,7 @@ index bc0e483a..d7c00066 100644
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index a59f61e7..f49bd144 100644
|
||||
index a59f61e73a..f49bd144ff 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
|
||||
@ -45,7 +45,7 @@ index a59f61e7..f49bd144 100644
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 0e33cb36..7a1dc33c 100644
|
||||
index 5fe81e42ab..05f9f90551 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -0,0 +0,0 @@ public class Main {
|
||||
@ -76,7 +76,7 @@ index 0e33cb36..7a1dc33c 100644
|
||||
MinecraftServer.main(options);
|
||||
} catch (Throwable t) {
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index 27297204..70b18719 100644
|
||||
index 27297204f1..70b187190f 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
|
||||
new file mode 100644
|
||||
index 0000000000..c2d2614181
|
||||
index 0000000000..c6818bc86a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
|
||||
@@ -0,0 +0,0 @@
|
||||
@ -24,6 +24,7 @@ index 0000000000..c2d2614181
|
||||
+// TODO: Re-implement missing timers
|
||||
+public final class MinecraftTimings {
|
||||
+
|
||||
+ public static final Timing serverOversleep = Timings.ofSafe("Server Oversleep");
|
||||
+ public static final Timing playerListTimer = Timings.ofSafe("Player List");
|
||||
+ public static final Timing commandFunctionsTimer = Timings.ofSafe("Command Functions");
|
||||
+ public static final Timing connectionTimer = Timings.ofSafe("Connection Handler");
|
||||
@ -724,7 +725,7 @@ index 2b13f4c9f9..47379046dc 100644
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index cec3794cd4..bc0e483a2a 100644
|
||||
index cec3794cd4..c76f262db9 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
@ -736,6 +737,17 @@ index cec3794cd4..bc0e483a2a 100644
|
||||
import org.spigotmc.SlackActivityAccountant; // Spigot
|
||||
|
||||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable {
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
});
|
||||
});
|
||||
private long nextTick = SystemUtils.getMonotonicMillis();
|
||||
- private long ab;
|
||||
- private boolean ac;
|
||||
+ private long ab; final long getTickOversleepMaxTime() { return this.ab; } // Paper - OBFHELPER
|
||||
+ private boolean ac; final boolean hasExecutedTask() { return this.ac; } // Paper - OBFHELPER
|
||||
private final IReloadableResourceManager ae;
|
||||
private final ResourcePackRepository<ResourcePackLoader> resourcePackRepository;
|
||||
@Nullable
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -744,6 +756,23 @@ index cec3794cd4..bc0e483a2a 100644
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
this.server.disablePlugins();
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ac ? this.ab : this.nextTick);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private boolean canOversleep() {
|
||||
+ return this.hasExecutedTask() && SystemUtils.getMonotonicMillis() < this.getTickOversleepMaxTime();
|
||||
+ }
|
||||
+
|
||||
+ private boolean canSleepForTickNoOversleep() {
|
||||
+ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < this.nextTick;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
private void executeModerately() {
|
||||
this.executeAll();
|
||||
java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
// CraftBukkit end
|
||||
|
||||
@ -751,14 +780,24 @@ index cec3794cd4..bc0e483a2a 100644
|
||||
- this.executeAll();
|
||||
+ //this.executeAll(); // Paper - move this into the tick method for timings
|
||||
this.awaitTasks(() -> {
|
||||
return !this.canSleepForTick();
|
||||
- return !this.canSleepForTick();
|
||||
+ return !this.canSleepForTickNoOversleep(); // Paper - move oversleep into full server tick
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
protected void exit() {}
|
||||
|
||||
protected void a(BooleanSupplier booleansupplier) {
|
||||
- SpigotTimings.serverTickTimer.startTiming(); // Spigot
|
||||
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
|
||||
+ // Paper start - move oversleep into full server tick
|
||||
+ MinecraftTimings.serverOversleep.startTiming();
|
||||
+ this.awaitTasks(() -> {
|
||||
+ return !this.canOversleep();
|
||||
+ });
|
||||
+ MinecraftTimings.serverOversleep.stopTiming();
|
||||
+ // Paper end
|
||||
this.slackActivityAccountant.tickStarted(); // Spigot
|
||||
long i = SystemUtils.getMonotonicNanos();
|
||||
|
||||
@ -1166,7 +1205,7 @@ index 1d5e4c5127..60c222b12b 100644
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Ticking entity");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked");
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 825e72e53a..a28c97a889 100644
|
||||
index 08f824228b..8a7e666473 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -185,7 +185,7 @@ index 895049287c..92d0aa6d66 100644
|
||||
System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
|
||||
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index f621350ea6..8fcffc9fa3 100644
|
||||
index 759c713976..6c9a43d66b 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ import org.apache.commons.lang3.Validate;
|
||||
@ -284,7 +284,7 @@ index 8e6f23d278..4c94e85e46 100644
|
||||
@Override
|
||||
public PluginCommand getPluginCommand(String name) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index ad1da9ddd3..d2bdd7c73f 100644
|
||||
index 78534c307c..c1ece9acd4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -0,0 +0,0 @@ import java.util.logging.Logger;
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] incremental chunk saving
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index de11a91af..4d3c6c6b4 100644
|
||||
index de11a91af6..4d3c6c6b47 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
@ -29,7 +29,7 @@ index de11a91af..4d3c6c6b4 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index ee8f80174..2003522d9 100644
|
||||
index ee8f801745..2003522d96 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
@ -42,7 +42,7 @@ index ee8f80174..2003522d9 100644
|
||||
private long t;
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 162700313..535c2258b 100644
|
||||
index 1627003134..535c2258b9 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@ -62,7 +62,7 @@ index 162700313..535c2258b 100644
|
||||
public void close() throws IOException {
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index c58f6f50d..229336040 100644
|
||||
index 098b3e5355..ccf359dff1 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@ -106,7 +106,7 @@ index c58f6f50d..229336040 100644
|
||||
this.methodProfiler.enter("snooper");
|
||||
if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && !this.snooper.d() && this.ticks > 100) { // Spigot
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index 493770bf6..2be6fa0f0 100644
|
||||
index 493770bf68..2be6fa0f07 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
@ -147,7 +147,7 @@ index 493770bf6..2be6fa0f0 100644
|
||||
if (flag) {
|
||||
List<PlayerChunk> list = (List) this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).peek(PlayerChunk::m).collect(Collectors.toList());
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 8a3124fed..e4cc24806 100644
|
||||
index 8a3124fed4..e4cc24806e 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] remove null possibility for getServer singleton
|
||||
to stop IDE complaining about potential NPE
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index e3bd80c934..17b9e9a31d 100644
|
||||
index b4eb53f28a..fbad6a31c1 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ import org.spigotmc.SlackActivityAccountant; // Spigot
|
||||
|
Loading…
Reference in New Issue
Block a user