mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Relocate Timings v2 patch
This commit is contained in:
parent
5dc69ba6e1
commit
fc2341a996
11 changed files with 78 additions and 76 deletions
|
@ -305,8 +305,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
import com.google.common.base.Predicate;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
} catch (Throwable throwable1) {
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
entity.tickTimer.stopTiming();
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
- System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ);
|
||||
+ String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ;
|
||||
+ System.err.println(msg);
|
||||
|
@ -316,9 +316,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
continue;
|
||||
// Paper end
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.methodProfiler.b();
|
||||
} catch (Throwable throwable2) {
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
tileentity.tickTimer.stopTiming();
|
||||
- System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
|
||||
+ String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ();
|
||||
+ System.err.println(msg);
|
||||
|
|
|
@ -24,11 +24,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
});
|
||||
this.getServer().addWorld(this.world);
|
||||
// CraftBukkit end
|
||||
timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
|
||||
+ this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper
|
||||
timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
|
||||
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
|
||||
}
|
||||
--
|
|
@ -8,42 +8,14 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -0,0 +0,0 @@ package org.spigotmc;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
-import net.minecraft.server.AxisAlignedBB;
|
||||
-import net.minecraft.server.Chunk;
|
||||
-import net.minecraft.server.Entity;
|
||||
-import net.minecraft.server.EntityAmbient;
|
||||
-import net.minecraft.server.EntityAnimal;
|
||||
-import net.minecraft.server.EntityArrow;
|
||||
-import net.minecraft.server.EntityComplexPart;
|
||||
-import net.minecraft.server.EntityCreature;
|
||||
-import net.minecraft.server.EntityCreeper;
|
||||
-import net.minecraft.server.EntityEnderCrystal;
|
||||
-import net.minecraft.server.EntityEnderDragon;
|
||||
-import net.minecraft.server.EntityFireball;
|
||||
-import net.minecraft.server.EntityFireworks;
|
||||
-import net.minecraft.server.EntityHuman;
|
||||
-import net.minecraft.server.EntityLiving;
|
||||
-import net.minecraft.server.EntityMonster;
|
||||
-import net.minecraft.server.EntityProjectile;
|
||||
-import net.minecraft.server.EntitySheep;
|
||||
-import net.minecraft.server.EntitySlice;
|
||||
-import net.minecraft.server.EntitySlime;
|
||||
-import net.minecraft.server.EntityTNTPrimed;
|
||||
-import net.minecraft.server.EntityVillager;
|
||||
-import net.minecraft.server.EntityWeather;
|
||||
-import net.minecraft.server.EntityWither;
|
||||
-import net.minecraft.server.MathHelper;
|
||||
-import net.minecraft.server.MinecraftServer;
|
||||
-import net.minecraft.server.World;
|
||||
+
|
||||
+import net.minecraft.server.*;
|
||||
import org.bukkit.craftbukkit.SpigotTimings;
|
||||
|
||||
public class ActivationRange
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.server.EntityCreature;
|
||||
import net.minecraft.server.EntityCreeper;
|
||||
import net.minecraft.server.EntityEnderCrystal;
|
||||
import net.minecraft.server.EntityEnderDragon;
|
||||
+import net.minecraft.server.EntityFallingBlock; // Paper
|
||||
import net.minecraft.server.EntityFireball;
|
||||
import net.minecraft.server.EntityFireworks;
|
||||
import net.minecraft.server.EntityHuman;
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
|| entity instanceof EntityFireball
|
||||
|| entity instanceof EntityWeather
|
||||
|
|
|
@ -30,8 +30,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
}
|
||||
return time;
|
||||
public static void chunkLoadThreads() {
|
||||
minChunkLoadThreads = Math.min(6, getInt("settings.min-chunk-load-threads", 2)); // Keep people from doing stupid things with max of 6
|
||||
}
|
||||
+
|
||||
+ public static boolean enableFileIOThreadSleep;
|
||||
|
|
|
@ -12,14 +12,52 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return config.getString(path, config.getString(path));
|
||||
}
|
||||
|
||||
- private static void timings() {
|
||||
- boolean timings = getBoolean("timings.enabled", true);
|
||||
- boolean verboseTimings = getBoolean("timings.verbose", true);
|
||||
- TimingsManager.privacy = getBoolean("timings.server-name-privacy", false);
|
||||
- TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses"));
|
||||
- int timingHistoryInterval = getInt("timings.history-interval", 300);
|
||||
- int timingHistoryLength = getInt("timings.history-length", 3600);
|
||||
-
|
||||
-
|
||||
- Timings.setVerboseTimingsEnabled(verboseTimings);
|
||||
- Timings.setTimingsEnabled(timings);
|
||||
- Timings.setHistoryInterval(timingHistoryInterval * 20);
|
||||
- Timings.setHistoryLength(timingHistoryLength * 20);
|
||||
-
|
||||
- Bukkit.getLogger().log(Level.INFO, "Spigot Timings: " + timings +
|
||||
- " - Verbose: " + verboseTimings +
|
||||
- " - Interval: " + timeSummary(Timings.getHistoryInterval() / 20) +
|
||||
- " - Length: " + timeSummary(Timings.getHistoryLength() / 20));
|
||||
- }
|
||||
-
|
||||
- protected static String timeSummary(int seconds) {
|
||||
- String time = "";
|
||||
- if (seconds > 60 * 60) {
|
||||
- time += TimeUnit.SECONDS.toHours(seconds) + "h";
|
||||
- seconds /= 60;
|
||||
- }
|
||||
-
|
||||
- if (seconds > 0) {
|
||||
- time += TimeUnit.SECONDS.toMinutes(seconds) + "m";
|
||||
- }
|
||||
- return time;
|
||||
- }
|
||||
-
|
||||
public static boolean useInteractLimiter;
|
||||
private static void useInteractLimiter() {
|
||||
useInteractLimiter = getBoolean("settings.limit-player-interactions", true);
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
Bukkit.getLogger().log(Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users");
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public static int minChunkLoadThreads = 2;
|
||||
+ public static void chunkLoadThreads() {
|
||||
+ minChunkLoadThreads = Math.min(6, getInt("settings.min-chunk-load-threads", 2)); // Keep people from doing stupid things with max of 6
|
||||
+ }
|
||||
+
|
||||
public static boolean useInteractLimiter;
|
||||
private static void useInteractLimiter() {
|
||||
useInteractLimiter = getBoolean("settings.limit-player-interactions", true);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
|
||||
|
|
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
guardEntityList = true; // Spigot
|
||||
// CraftBukkit start - Use field for loop variable
|
||||
co.aikar.timings.TimingHistory.entityTicks += this.entityList.size(); // Paper
|
||||
int entitiesThisCycle = 0;
|
||||
- if (tickPosition < 0) tickPosition = 0;
|
||||
- for (entityLimiter.initTick();
|
||||
|
|
|
@ -36,12 +36,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -0,0 +0,0 @@ public class ActivationRange
|
||||
SpigotTimings.checkIfActiveTimer.startTiming();
|
||||
{
|
||||
// Never safe to skip fireworks or entities not yet added to chunk
|
||||
// PAIL: inChunk
|
||||
- if ( !entity.aa || entity instanceof EntityFireworks ) {
|
||||
+ if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { // Paper - EAR: Fix bug with teleporting entities
|
||||
SpigotTimings.checkIfActiveTimer.stopTiming();
|
||||
return true;
|
||||
}
|
||||
|
||||
--
|
|
@ -50,8 +50,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
this.methodProfiler.a("cleaning");
|
||||
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
this.U.add(nextticklistentry);
|
||||
}
|
||||
timings.scheduledBlocksCleanup.stopTiming(); // Paper
|
||||
|
||||
+ // Paper start - Allow redstone ticks to bypass the tickNextTickListCap
|
||||
+ if (paperConfig.tickNextTickListCapIgnoresRedstone) {
|
||||
|
@ -73,5 +73,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
this.methodProfiler.b();
|
||||
this.methodProfiler.a("ticking");
|
||||
Iterator iterator = this.U.iterator();
|
||||
timings.scheduledBlocksTicking.startTiming(); // Paper
|
||||
--
|
|
@ -27,15 +27,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.g(entity);
|
||||
SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
|
||||
entity.tickTimer.stopTiming(); // Paper
|
||||
} catch (Throwable throwable1) {
|
||||
entity.tickTimer.stopTiming();
|
||||
- crashreport1 = CrashReport.a(throwable1, "Ticking entity");
|
||||
- crashreportsystemdetails1 = crashreport1.a("Entity being ticked");
|
||||
- entity.appendEntityCrashDetails(crashreportsystemdetails1);
|
||||
- throw new ReportedException(crashreport1);
|
||||
+ // Paper start - Prevent tile entity and entity crashes
|
||||
+ SpigotTimings.tickEntityTimer.stopTiming();
|
||||
+ System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ);
|
||||
+ throwable1.printStackTrace();
|
||||
+ entity.dead = true;
|
||||
|
@ -53,7 +52,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- tileentity.a(crashreportsystemdetails1);
|
||||
- throw new ReportedException(crashreport1);
|
||||
+ // Paper start - Prevent tile entity and entity crashes
|
||||
+ tileentity.tickTimer.stopTiming();
|
||||
+ System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
|
||||
+ throwable2.printStackTrace();
|
||||
+ tilesThisCycle--;
|
||||
|
|
|
@ -218,8 +218,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public class PaperConfig {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
Bukkit.getLogger().log(Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users");
|
||||
}
|
||||
config.addDefault(path, def);
|
||||
return config.getString(path, config.getString(path));
|
||||
}
|
||||
+
|
||||
+ private static void timings() {
|
||||
|
@ -554,9 +554,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public static boolean haveWeSilencedAPhysicsCrash;
|
||||
public static String blockLocation;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
});
|
||||
this.getServer().addWorld(this.world);
|
||||
// CraftBukkit end
|
||||
this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper
|
||||
- timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
|
||||
+ timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
|
||||
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
|
||||
|
@ -584,8 +584,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// CraftBukkit start - Use field for loop variable
|
||||
+ co.aikar.timings.TimingHistory.entityTicks += this.entityList.size(); // Paper
|
||||
int entitiesThisCycle = 0;
|
||||
// Paper start - Disable tick limiters
|
||||
//if (tickPosition < 0) tickPosition = 0;
|
||||
if (tickPosition < 0) tickPosition = 0;
|
||||
for (entityLimiter.initTick();
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
this.methodProfiler.a("tick");
|
||||
if (!entity.dead && !(entity instanceof EntityPlayer)) {
|
||||
|
@ -596,12 +596,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
|
||||
+ entity.tickTimer.stopTiming(); // Paper
|
||||
} catch (Throwable throwable1) {
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
- SpigotTimings.tickEntityTimer.stopTiming();
|
||||
+ entity.tickTimer.stopTiming();
|
||||
System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ);
|
||||
throwable1.printStackTrace();
|
||||
entity.dead = true;
|
||||
crashreport1 = CrashReport.a(throwable1, "Ticking entity");
|
||||
crashreportsystemdetails1 = crashreport1.a("Entity being ticked");
|
||||
entity.appendEntityCrashDetails(crashreportsystemdetails1);
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
|
@ -688,10 +686,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
+ timings.scheduledBlocksCleanup.stopTiming(); // Paper
|
||||
|
||||
// Paper start - Allow redstone ticks to bypass the tickNextTickListCap
|
||||
if (paperConfig.tickNextTickListCapIgnoresRedstone) {
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
|
||||
this.methodProfiler.b();
|
||||
this.methodProfiler.a("ticking");
|
||||
+ timings.scheduledBlocksTicking.startTiming(); // Paper
|
||||
|
@ -1109,10 +1103,10 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -0,0 +0,0 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.server.*;
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.server.EntityWither;
|
||||
import net.minecraft.server.MathHelper;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.World;
|
||||
-import org.bukkit.craftbukkit.SpigotTimings;
|
||||
+import co.aikar.timings.SpigotTimings;
|
||||
|
||||
|
@ -1125,7 +1119,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- SpigotTimings.checkIfActiveTimer.startTiming();
|
||||
// Never safe to skip fireworks or entities not yet added to chunk
|
||||
// PAIL: inChunk
|
||||
if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { // Paper - EAR: Fix bug with teleporting entities
|
||||
if ( !entity.aa || entity instanceof EntityFireworks ) {
|
||||
- SpigotTimings.checkIfActiveTimer.stopTiming();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
config.addDefault(path, def);
|
||||
return config.getString(path, config.getString(path));
|
||||
}
|
||||
return time;
|
||||
}
|
||||
+
|
||||
+ public static boolean useInteractLimiter;
|
||||
|
|
Loading…
Reference in a new issue