Overhaul to Timings and Entity Activation Range

This greatly extends the timings improvements I've done in recent commits, and brings timings to fully cover the entire tick.
The timings system also now tracks when specific timings causes the server to lose TPS.
The timings are also able to be turned on "on demand", meaning you do not need to restart the server to enable them.

This commit also overhauls the Entity Activation Range feature, fixing bugs, adding more immunities, and improving the performance of it.
It also fixes a regression with a recent Spigot commit that broke the entire Entity Activation Range feature.

This commit had to move the Tick Loop patch before timings because there was a change done there to time the entire tick, so lots of renames.

These 2 commits had to be bundled together to simplify applying them and reduce redundant conflict resolution.

By: Aikar <aikar@aikar.co>
This commit is contained in:
Spigot
2013-02-26 12:21:40 -05:00
parent 7c1adc0df4
commit 3be016271f
17 changed files with 1503 additions and 960 deletions

View File

@@ -1,31 +1,31 @@
From bcc479e29c57f5e24066b2971a911e1e0aab02c7 Mon Sep 17 00:00:00 2001
From 5a0d969c584b848bd8fcb62f4b3178c071801edb 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.
---
.../java/net/minecraft/server/MinecraftServer.java | 2 +
src/main/java/org/bukkit/craftbukkit/Spigot.java | 77 +++++++++++++++++-
src/main/java/org/bukkit/craftbukkit/Spigot.java | 76 +++++++++++++++++-
src/main/java/org/spigotmc/RestartCommand.java | 23 ++++++
src/main/java/org/spigotmc/WatchdogThread.java | 93 ++++++++++++++++++++++
src/main/resources/configurations/bukkit.yml | 3 +
5 files changed, 196 insertions(+), 2 deletions(-)
5 files changed, 195 insertions(+), 2 deletions(-)
create mode 100644 src/main/java/org/spigotmc/RestartCommand.java
create mode 100644 src/main/java/org/spigotmc/WatchdogThread.java
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 128016f..3a6b620 100644
index aa6a14a..6005fac 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -418,6 +418,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
lastTick = curTime;
MinecraftServer.currentTick++;
@@ -421,6 +421,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.q();
SpigotTimings.serverTickTimer.stopTiming();
org.bukkit.CustomTimingsHandler.tick();
+ org.spigotmc.WatchdogThread.tick();
}
// Spigot end
} else {
@@ -445,6 +446,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@@ -448,6 +449,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.a(crashreport);
} finally {
try {
@@ -34,7 +34,7 @@ index 128016f..3a6b620 100644
this.isStopped = true;
} catch (Throwable throwable1) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index ced4bd4..15acc97 100644
index 3171411..6f54f7e 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -1,5 +1,6 @@
@@ -44,8 +44,8 @@ index ced4bd4..15acc97 100644
import java.io.IOException;
import java.util.ArrayList;
import net.minecraft.server.*;
@@ -7,16 +8,20 @@ import org.bukkit.command.SimpleCommandMap;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -8,9 +9,11 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.util.List;
import java.util.logging.Level;
-import java.util.logging.Logger;
@@ -56,9 +56,8 @@ index ced4bd4..15acc97 100644
+import org.spigotmc.WatchdogThread;
public class Spigot {
+
public static boolean tabPing = false;
private static Metrics metrics;
static AxisAlignedBB maxBB = AxisAlignedBB.a(0,0,0,0,0,0);
@@ -23,6 +26,7 @@ public class Spigot {
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps"));
@@ -66,7 +65,7 @@ index ced4bd4..15acc97 100644
server.whitelistMessage = configuration.getString("settings.whitelist-message", server.whitelistMessage);
server.stopMessage = configuration.getString("settings.stop-message", server.stopMessage);
@@ -25,12 +30,21 @@ public class Spigot {
@@ -31,12 +35,21 @@ public class Spigot {
server.commandComplete = configuration.getBoolean("settings.command-complete", true);
server.spamGuardExclusions = configuration.getStringList("settings.spam-exclusions");
@@ -89,9 +88,9 @@ index ced4bd4..15acc97 100644
}
if (server.chunkGCPeriod == 0) {
@@ -193,4 +207,63 @@ public class Spigot {
return (entity instanceof EntityArrow && !((EntityArrow) entity).inGround);
@@ -265,4 +278,63 @@ public class Spigot {
SpigotTimings.checkIfActiveTimer.stopTiming();
return isActive;
}
+
+ public static void restart() {
@@ -282,7 +281,7 @@ index 0000000..10390b8
+ }
+}
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
index 54e28db..e04ebce 100644
index e568bf6..7c18391 100644
--- a/src/main/resources/configurations/bukkit.yml
+++ b/src/main/resources/configurations/bukkit.yml
@@ -31,6 +31,9 @@ settings:
@@ -296,5 +295,5 @@ index 54e28db..e04ebce 100644
default:
growth-chunks-per-tick: 650
--
1.8.1-rc2
1.8.1.1