Re-add recentTps array for plugins that make bad choices
This commit is contained in:
parent
56afbe3f71
commit
fe4c7c88ac
@ -1,4 +1,4 @@
|
||||
From f92b84536fcd930f5160039476dfae760c550645 Mon Sep 17 00:00:00 2001
|
||||
From a034823848869c3e53707f9c30a9df2ce171db27 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
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
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 0de8fc2d43f4864027f86266e157d2d7009cfa55 Mon Sep 17 00:00:00 2001
|
||||
From 2cd37e23df2ba3480711fdd100abb7e46482e1aa Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user