From fe4c7c88ac950bce9e4e0ebeb93af2e8f855c0b2 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 26 Jul 2015 15:58:37 -0500 Subject: [PATCH] Re-add recentTps array for plugins that make bad choices --- ...028-Further-improve-server-tick-loop.patch | 20 +++++++++++-------- .../0054-Optimize-explosions.patch | 10 +++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Spigot-Server-Patches/0028-Further-improve-server-tick-loop.patch b/Spigot-Server-Patches/0028-Further-improve-server-tick-loop.patch index dfc946f..3e296f2 100644 --- a/Spigot-Server-Patches/0028-Further-improve-server-tick-loop.patch +++ b/Spigot-Server-Patches/0028-Further-improve-server-tick-loop.patch @@ -1,4 +1,4 @@ -From f92b84536fcd930f5160039476dfae760c550645 Mon Sep 17 00:00:00 2001 +From a034823848869c3e53707f9c30a9df2ce171db27 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 8 Mar 2015 03:47:32 -0500 Subject: [PATCH] Further improve server tick loop @@ -12,7 +12,7 @@ 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 1061088..a66ea75 100644 +index 1061088..0e88078 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -111,17 +111,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs @@ -34,7 +34,7 @@ index 1061088..a66ea75 100644 public MinecraftServer(OptionSet options, Proxy proxy, File file1) { io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable -@@ -512,12 +506,53 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs +@@ -512,12 +506,54 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.isRunning = false; } @@ -51,6 +51,7 @@ index 1061088..a66ea75 100644 + public final RollingAverage tps1 = new RollingAverage(60); + public final RollingAverage tps5 = new RollingAverage(60 * 5); + public final RollingAverage tps15 = new RollingAverage(60 * 15); ++ public double[] recentTps = new double[ 3 ]; // PaperSpigot - Fine have your darn compat with bad plugins + + public static class RollingAverage { + private final int size; @@ -93,14 +94,13 @@ index 1061088..a66ea75 100644 public void run() { try { -@@ -530,26 +565,43 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs +@@ -530,26 +566,47 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.a(this.r); // Spigot start -- Arrays.fill( recentTps, 20 ); -- long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; + // PaperSpigot start - Further improve tick loop -+ //Arrays.fill( recentTps, 20 ); + Arrays.fill( recentTps, 20 ); +- long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; + //long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; + long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; + // PaperSpigot end @@ -144,6 +144,10 @@ index 1061088..a66ea75 100644 + tps1.add(currentTps, diff); + tps5.add(currentTps, diff); + tps15.add(currentTps, diff); ++ // Backwards compat with bad plugins ++ recentTps[0] = tps1.getAverage(); ++ recentTps[1] = tps5.getAverage(); ++ recentTps[2] = tps15.getAverage(); tickSection = curTime; + // PaperSpigot end } @@ -212,5 +216,5 @@ index be2e31d..21fd7ef 100644 return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString() + ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); -- -1.9.5.msysgit.1 +2.4.5.windows.1 diff --git a/Spigot-Server-Patches/0054-Optimize-explosions.patch b/Spigot-Server-Patches/0054-Optimize-explosions.patch index 427e447..dbb39ba 100644 --- a/Spigot-Server-Patches/0054-Optimize-explosions.patch +++ b/Spigot-Server-Patches/0054-Optimize-explosions.patch @@ -1,4 +1,4 @@ -From 0de8fc2d43f4864027f86266e157d2d7009cfa55 Mon Sep 17 00:00:00 2001 +From 2cd37e23df2ba3480711fdd100abb7e46482e1aa Mon Sep 17 00:00:00 2001 From: Byteflux Date: Tue, 16 Jun 2015 05:52:58 -0700 Subject: [PATCH] Optimize explosions @@ -110,10 +110,10 @@ index f40f465..4afb8d7 100644 + // PaperSpigot end } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index a66ea75..5c3518a 100644 +index 0e88078..4945043 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -855,6 +855,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs +@@ -860,6 +860,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs worldserver.timings.tracker.stopTiming(); // Spigot this.methodProfiler.b(); this.methodProfiler.b(); @@ -122,7 +122,7 @@ index a66ea75..5c3518a 100644 // this.i[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e96fa6f..294f54c 100644 +index b3e77d5..39cf1a3 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -133,6 +133,7 @@ public abstract class World implements IBlockAccess { @@ -149,5 +149,5 @@ index 0b75e16..4596e9d 100644 + } } -- -1.9.5.msysgit.1 +2.4.5.windows.1