Add more timings to chunk provider tick (#2549)
- Misc mob spawning - Chunk range checks
This commit is contained in:
@@ -147,7 +147,7 @@ index 0000000000..c6818bc86a
|
||||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
||||
new file mode 100644
|
||||
index 0000000000..92c32c48d2
|
||||
index 0000000000..3a79cde595
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
||||
@@ -0,0 +0,0 @@
|
||||
@@ -211,6 +211,11 @@ index 0000000000..92c32c48d2
|
||||
+ public final Timing worldSaveLevel;
|
||||
+ public final Timing chunkSaveData;
|
||||
+
|
||||
+
|
||||
+ public final Timing miscMobSpawning;
|
||||
+ public final Timing chunkRangeCheckBig;
|
||||
+ public final Timing chunkRangeCheckSmall;
|
||||
+
|
||||
+ public WorldTimingsHandler(World server) {
|
||||
+ String name = server.worldData.getName() +" - ";
|
||||
+
|
||||
@@ -265,6 +270,11 @@ index 0000000000..92c32c48d2
|
||||
+ chunkProviderTick = Timings.ofSafe(name + "Chunk provider tick");
|
||||
+ broadcastChunkUpdates = Timings.ofSafe(name + "Broadcast chunk updates");
|
||||
+ countNaturalMobs = Timings.ofSafe(name + "Count natural mobs");
|
||||
+
|
||||
+
|
||||
+ miscMobSpawning = Timings.ofSafe(name + "Mob spawning - Misc");
|
||||
+ chunkRangeCheckBig = Timings.ofSafe(name + "Chunk Tick Range - Big");
|
||||
+ chunkRangeCheckSmall = Timings.ofSafe(name + "Chunk Tick Range - Small");
|
||||
+ }
|
||||
+
|
||||
+ public static Timing getTickList(WorldServer worldserver, String timingsType) {
|
||||
@@ -359,7 +369,7 @@ index 3ed48be382..c4d989f702 100644
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 3b785a3ade..e51e3b74cc 100644
|
||||
index 3b785a3ade..15480a8dfb 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -421,6 +431,26 @@ index 3b785a3ade..e51e3b74cc 100644
|
||||
this.world.getMethodProfiler().exit();
|
||||
ChunkCoordIntPair chunkcoordintpair = playerchunk.i();
|
||||
|
||||
- if (!this.playerChunkMap.isOutsideOfRange(chunkcoordintpair)) {
|
||||
+ // Paper start - timings
|
||||
+ this.world.timings.chunkRangeCheckBig.startTiming();
|
||||
+ // note: this is just a copy of the expression in the if
|
||||
+ boolean bigRadiusOutsideRange = !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair);
|
||||
+ this.world.timings.chunkRangeCheckBig.stopTiming();
|
||||
+ if (bigRadiusOutsideRange) {
|
||||
+ // Paper end
|
||||
chunk.b(chunk.q() + j);
|
||||
- if (flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot
|
||||
+ // Paper start - timings
|
||||
+ this.world.timings.chunkRangeCheckSmall.startTiming();
|
||||
+ // note: this is just a copy of the expression in the if
|
||||
+ boolean smallRadiusOutsideRange = flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true);
|
||||
+ this.world.timings.chunkRangeCheckSmall.stopTiming();
|
||||
+ if (smallRadiusOutsideRange) { // Spigot
|
||||
+ // Paper end
|
||||
this.world.getMethodProfiler().enter("spawner");
|
||||
this.world.timings.mobSpawn.startTiming(); // Spigot
|
||||
EnumCreatureType[] aenumcreaturetype1 = aenumcreaturetype;
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.getMethodProfiler().exit();
|
||||
}
|
||||
@@ -433,7 +463,14 @@ index 3b785a3ade..e51e3b74cc 100644
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.getMethodProfiler().enter("customSpawners");
|
||||
if (flag1) {
|
||||
+ try (co.aikar.timings.Timing ignored = this.world.timings.miscMobSpawning.startTiming()) { // Paper - timings
|
||||
this.chunkGenerator.doMobSpawning(this.world, this.allowMonsters, this.allowAnimals);
|
||||
+ } // Paper - timings
|
||||
}
|
||||
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.world.getMethodProfiler().exit();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user