Properly report TPS when catching up

This commit is contained in:
Aikar 2013-06-08 09:20:25 +10:00 committed by md_5
parent 65a4fdef3c
commit 84089dc4ae
5 changed files with 25 additions and 23 deletions

View File

@ -1,4 +1,4 @@
From a13cbbfb3edbbccf0866e72322dca3d8d88f9b2d Mon Sep 17 00:00:00 2001
From c249eb223ad161d2a850e9b575956ed0034d676f Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 4 May 2013 10:14:01 +1000
Subject: [PATCH] Spigot Changes
@ -239,7 +239,7 @@ index bee715b..9643480 100644
if (pendingchunktosave != null) {
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 42dbc56..e9f39c7 100644
index cc99ff5..1697b18 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -845,8 +845,20 @@ public class PlayerConnection extends Connection {
@ -273,7 +273,7 @@ index 42dbc56..e9f39c7 100644
if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) {
return;
}
@@ -1558,8 +1570,9 @@ public class PlayerConnection extends Connection {
@@ -1554,8 +1566,9 @@ public class PlayerConnection extends Connection {
flag = false;
} else {
for (i = 0; i < packet130updatesign.lines[j].length(); ++i) {

View File

@ -1,11 +1,11 @@
From a1f7d665a0c8e86ffe0fb3627c08f886836baf04 Mon Sep 17 00:00:00 2001
From c1828561102ac926f5a7a3f3f4d9d3f7d415fe3a Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 3 Feb 2013 12:28:17 +1100
Subject: [PATCH] Tick loop optimization - sleep for as long as possible.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3e134fb..3c80340 100644
index 3e134fb..16df63f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -84,6 +84,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@ -21,7 +21,7 @@ index 3e134fb..3c80340 100644
public MinecraftServer(OptionSet options) { // CraftBukkit - signature file -> OptionSet
k = this;
@@ -380,39 +386,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -380,39 +386,25 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public void run() {
try {
if (this.init()) {
@ -62,7 +62,9 @@ index 3e134fb..3c80340 100644
- j -= 50L;
- this.q();
- }
+ catchupTime = Math.min(TICK_TIME * TPS, Math.abs(wait));
+ long left = Math.abs(wait);
+ lastTick -= Math.min(TICK_TIME, left);
+ catchupTime = Math.min(TICK_TIME * TPS, left);
}
-
- Thread.sleep(1L);

View File

@ -1,4 +1,4 @@
From d110295433aaf1e10fec3b918e8a9882c2dfb429 Mon Sep 17 00:00:00 2001
From 57f7eba1d84ac95d596f8f87379fce40f9839398 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 10 Jan 2013 00:18:11 -0500
Subject: [PATCH] Improved Timings System
@ -132,7 +132,7 @@ index 965e6ce..58a4acb 100644
this.world.methodProfiler.b();
this.world.methodProfiler.a("looting");
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3c80340..db396b3 100644
index 16df63f..523d83e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -6,7 +6,6 @@ import java.security.KeyPair;
@ -151,7 +151,7 @@ index 3c80340..db396b3 100644
import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.server.RemoteServerCommandEvent;
import org.bukkit.event.world.WorldSaveEvent;
@@ -400,7 +400,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -402,7 +402,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
currentTPS = (currentTPS * 0.95) + (1E9 / (curTime - lastTick) * 0.05);
lastTick = curTime;
MinecraftServer.currentTick++;
@ -162,7 +162,7 @@ index 3c80340..db396b3 100644
}
// Spigot end
} else {
@@ -499,6 +502,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -501,6 +504,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public void r() {
this.methodProfiler.a("levels");
@ -170,7 +170,7 @@ index 3c80340..db396b3 100644
// CraftBukkit start
this.server.getScheduler().mainThreadHeartbeat(this.ticks);
@@ -507,7 +511,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -509,7 +513,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
processQueue.remove().run();
}
@ -181,7 +181,7 @@ index 3c80340..db396b3 100644
// Send time updates to everyone, it will get the right time from the world the player is in.
if (this.ticks % 20 == 0) {
@@ -559,7 +566,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -561,7 +568,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.methodProfiler.b();
this.methodProfiler.a("tracker");
@ -191,7 +191,7 @@ index 3c80340..db396b3 100644
this.methodProfiler.b();
this.methodProfiler.b();
// } // CraftBukkit
@@ -568,14 +577,20 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -570,14 +579,20 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
this.methodProfiler.c("connection");
@ -213,7 +213,7 @@ index 3c80340..db396b3 100644
this.methodProfiler.b();
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e9f39c7..46b575c 100644
index 1697b18..a2b63c1 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -968,6 +968,7 @@ public class PlayerConnection extends Connection {

View File

@ -1,14 +1,14 @@
From df94e657a276b27d690c146e8a8d11f703c17600 Mon Sep 17 00:00:00 2001
From 67bebf0283ca650922f9f251689fdf61b82f8020 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Feb 2013 12:33:20 +1100
Subject: [PATCH] Watchdog Thread.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index db396b3..d197f06 100644
index 523d83e..1079d1c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -404,6 +404,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -406,6 +406,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.q();
SpigotTimings.serverTickTimer.stopTiming();
org.spigotmc.CustomTimingsHandler.tick();
@ -16,7 +16,7 @@ index db396b3..d197f06 100644
}
// Spigot end
} else {
@@ -431,6 +432,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -433,6 +434,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.a(crashreport);
} finally {
try {

View File

@ -1,4 +1,4 @@
From 890ebddcce4bf2ca1660e415c05485797feb80ef Mon Sep 17 00:00:00 2001
From f27c36d6c48cfa8868841ebfcd3611605467cdb0 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 13:04:45 +1100
Subject: [PATCH] Texture Pack Resolutions
@ -6,10 +6,10 @@ Subject: [PATCH] Texture Pack Resolutions
Fix issues when specifiying a server texture pack URL with resolution != 16.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d197f06..e348ac5 100644
index 1079d1c..96cf583 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1076,7 +1076,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -1078,7 +1078,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public int S() {
@ -39,7 +39,7 @@ index 861cfd9..9ac137a 100644
if (metrics == null) {
try {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 26cb661..382fc41 100644
index d70c110..3d39d07 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -830,7 +830,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {