mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
Fixup improve tick loop patch
This commit is contained in:
parent
17fc3c017e
commit
71490b2325
@ -1,4 +1,4 @@
|
||||
From 09cb0d01eeb61e890d63874ea8a5aaafc9df03e2 Mon Sep 17 00:00:00 2001
|
||||
From fd2388050096e00efb4c5a9c9db2d604ad1aa693 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 1 Mar 2016 23:09:29 -0600
|
||||
Subject: [PATCH] Further improve server tick loop
|
||||
@ -12,9 +12,18 @@ Previous implementation did not calculate TPS correctly.
|
||||
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index d8874c398..6fbf841f0 100644
|
||||
index c72bdd29d1..c7b0cdaa20 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -76,7 +76,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
private final List<ITickable> l = Lists.newArrayList();
|
||||
public final MethodProfiler methodProfiler = new MethodProfiler();
|
||||
private ServerConnection m; // Spigot
|
||||
- private final ServerPing n = new ServerPing();
|
||||
+4 private final ServerPing n = new ServerPing();
|
||||
private final Random o = new Random();
|
||||
public final DataFixer dataConverterManager;
|
||||
private String serverIp;
|
||||
@@ -142,7 +142,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
public org.bukkit.command.ConsoleCommandSender console;
|
||||
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
|
||||
@ -99,7 +108,7 @@ index d8874c398..6fbf841f0 100644
|
||||
|
||||
// Spigot start
|
||||
Arrays.fill( recentTps, 20 );
|
||||
- long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick;
|
||||
- long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick, tickCount = 1;
|
||||
+ long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; // Paper - Further improve server tick loop
|
||||
while (this.isRunning) {
|
||||
curTime = System.nanoTime();
|
||||
@ -127,7 +136,7 @@ index d8874c398..6fbf841f0 100644
|
||||
+ wait = TICK_TIME - (curTime - lastTick);
|
||||
}
|
||||
|
||||
- if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 )
|
||||
- if ( tickCount++ % SAMPLE_INTERVAL == 0 )
|
||||
+ catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait);
|
||||
+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 )
|
||||
{
|
||||
@ -149,7 +158,7 @@ index d8874c398..6fbf841f0 100644
|
||||
}
|
||||
lastTick = curTime;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index c2d479dd1..d28205cdf 100644
|
||||
index c2d479dd11..d28205cdfc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1836,6 +1836,17 @@ public final class CraftServer implements Server {
|
||||
@ -171,7 +180,7 @@ index c2d479dd1..d28205cdf 100644
|
||||
{
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
index be2e31dea..6d21c3269 100644
|
||||
index be2e31deae..6d21c32692 100644
|
||||
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
@@ -1,8 +1,5 @@
|
||||
|
Loading…
Reference in New Issue
Block a user