Add sub timings to chunk map

This commit is contained in:
Aikar 2016-06-05 00:10:50 -04:00
parent c2fd63eebf
commit b394ec0472
4 changed files with 138 additions and 24 deletions

View File

@ -1,11 +1,11 @@
From 1e9a4f7eedf6ac49348969aa5e1337b0077065de Mon Sep 17 00:00:00 2001 From fb2ea5754f6414174122a0d0186e402a0cbee9ca Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600 Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2 Subject: [PATCH] Timings v2
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 90fde44..c31ee8f 100644 index 00edfb5..79d2171 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -65,6 +65,12 @@ @@ -65,6 +65,12 @@
@ -139,10 +139,10 @@ index 0000000..0f8315c
+} +}
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
new file mode 100644 new file mode 100644
index 0000000..11dd692 index 0000000..741da72
--- /dev/null --- /dev/null
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -0,0 +1,71 @@ @@ -0,0 +1,85 @@
+package co.aikar.timings; +package co.aikar.timings;
+ +
+import net.minecraft.server.World; +import net.minecraft.server.World;
@ -161,6 +161,13 @@ index 0000000..11dd692
+ public final Timing chunkTicksBlocks; + public final Timing chunkTicksBlocks;
+ public final Timing doVillages; + public final Timing doVillages;
+ public final Timing doChunkMap; + public final Timing doChunkMap;
+ public final Timing doChunkMapUpdate;
+ public final Timing doChunkMapToUpdate;
+ public final Timing doChunkMapSortMissing;
+ public final Timing doChunkMapSortSendToPlayers;
+ public final Timing doChunkMapPlayersNeedingChunks;
+ public final Timing doChunkMapPendingSendToPlayers;
+ public final Timing doChunkMapUnloadChunks;
+ public final Timing doChunkGC; + public final Timing doChunkGC;
+ public final Timing doSounds; + public final Timing doSounds;
+ public final Timing entityRemoval; + public final Timing entityRemoval;
@ -192,6 +199,13 @@ index 0000000..11dd692
+ chunkTicksBlocks = Timings.ofSafe(name + "Chunk Ticks - Blocks"); + chunkTicksBlocks = Timings.ofSafe(name + "Chunk Ticks - Blocks");
+ doVillages = Timings.ofSafe(name + "doVillages"); + doVillages = Timings.ofSafe(name + "doVillages");
+ doChunkMap = Timings.ofSafe(name + "doChunkMap"); + doChunkMap = Timings.ofSafe(name + "doChunkMap");
+ doChunkMapUpdate = Timings.ofSafe(name + "doChunkMap - Update");
+ doChunkMapToUpdate = Timings.ofSafe(name + "doChunkMap - To Update");
+ doChunkMapSortMissing = Timings.ofSafe(name + "doChunkMap - Sort Missing");
+ doChunkMapSortSendToPlayers = Timings.ofSafe(name + "doChunkMap - Sort Send To Players");
+ doChunkMapPlayersNeedingChunks = Timings.ofSafe(name + "doChunkMap - Players Needing Chunks");
+ doChunkMapPendingSendToPlayers = Timings.ofSafe(name + "doChunkMap - Pending Send To Players");
+ doChunkMapUnloadChunks = Timings.ofSafe(name + "doChunkMap - Unload Chunks");
+ doSounds = Timings.ofSafe(name + "doSounds"); + doSounds = Timings.ofSafe(name + "doSounds");
+ doChunkGC = Timings.ofSafe(name + "doChunkGC"); + doChunkGC = Timings.ofSafe(name + "doChunkGC");
+ doPortalForcer = Timings.ofSafe(name + "doPortalForcer"); + doPortalForcer = Timings.ofSafe(name + "doPortalForcer");
@ -595,6 +609,106 @@ index e17d5d3..8845ad2 100644
this.methodProfiler.b(); this.methodProfiler.b();
} }
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index b0249ff..797a84f 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import co.aikar.timings.Timing;
import com.google.common.base.Predicate;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.ComparisonChain;
@@ -106,6 +107,7 @@ public class PlayerChunkMap {
PlayerChunk playerchunk;
if (i - this.k > 8000L) {
+ try (Timing ignored = world.timings.doChunkMapUpdate.startTiming()) { // Paper
this.k = i;
for (j = 0; j < this.i.size(); ++j) {
@@ -113,9 +115,11 @@ public class PlayerChunkMap {
playerchunk.d();
playerchunk.c();
}
+ } // Paper timing
}
if (!this.f.isEmpty()) {
+ try (Timing ignored = world.timings.doChunkMapToUpdate.startTiming()) { // Paper
Iterator iterator = this.f.iterator();
while (iterator.hasNext()) {
@@ -124,10 +128,12 @@ public class PlayerChunkMap {
}
this.f.clear();
+ } // Paper timing
}
if (this.l && i % 4L == 0L) {
this.l = false;
+ try (Timing ignored = world.timings.doChunkMapSortMissing.startTiming()) { // Paper
Collections.sort(this.h, new Comparator() {
public int a(PlayerChunk playerchunk, PlayerChunk playerchunk1) {
return ComparisonChain.start().compare(playerchunk.g(), playerchunk1.g()).result();
@@ -137,10 +143,12 @@ public class PlayerChunkMap {
return this.a((PlayerChunk) object, (PlayerChunk) object1);
}
});
+ } // Paper timing
}
if (this.m && i % 4L == 2L) {
this.m = false;
+ try (Timing ignored = world.timings.doChunkMapSortSendToPlayers.startTiming()) { // Paper
Collections.sort(this.g, new Comparator() {
public int a(PlayerChunk playerchunk, PlayerChunk playerchunk1) {
return ComparisonChain.start().compare(playerchunk.g(), playerchunk1.g()).result();
@@ -150,9 +158,11 @@ public class PlayerChunkMap {
return this.a((PlayerChunk) object, (PlayerChunk) object1);
}
});
+ } // Paper timing
}
if (!this.h.isEmpty()) {
+ try (Timing ignored = world.timings.doChunkMapPlayersNeedingChunks.startTiming()) { // Paper
long k = System.nanoTime() + 50000000L;
int l = 49;
Iterator iterator1 = this.h.iterator();
@@ -176,10 +186,12 @@ public class PlayerChunkMap {
}
}
}
+ } // Paper timing
}
if (!this.g.isEmpty()) {
j = 81;
+ try (Timing ignored = world.timings.doChunkMapPendingSendToPlayers.startTiming()) { // Paper
Iterator iterator2 = this.g.iterator();
while (iterator2.hasNext()) {
@@ -193,14 +205,17 @@ public class PlayerChunkMap {
}
}
}
+ } // Paper timing
}
if (this.managedPlayers.isEmpty()) {
+ try (Timing ignored = world.timings.doChunkMapUnloadChunks.startTiming()) { // Paper
WorldProvider worldprovider = this.world.worldProvider;
if (!worldprovider.e()) {
this.world.getChunkProviderServer().b();
}
+ } // Paper timing
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0a14dd2..7c52e15 100644 index 0a14dd2..7c52e15 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
@ -664,7 +778,7 @@ index 0cb2e63..6d4f4e7 100644
private static Map<String, Class<? extends TileEntity>> f = Maps.newHashMap(); private static Map<String, Class<? extends TileEntity>> f = Maps.newHashMap();
private static Map<Class<? extends TileEntity>, String> g = Maps.newHashMap(); private static Map<Class<? extends TileEntity>, String> g = Maps.newHashMap();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 4dd6777..0c3ed2d 100644 index 78045c5..7d1272b 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -18,11 +18,11 @@ import com.google.common.collect.Maps; @@ -18,11 +18,11 @@ import com.google.common.collect.Maps;
@ -1298,5 +1412,5 @@ index a752376..8870607 100644
} }
} }
-- --
2.8.2 2.8.3

View File

@ -1,4 +1,4 @@
From 3d850d42da698e6b342438418e47b4e1b663c722 Mon Sep 17 00:00:00 2001 From bd8d55cdb864658c3e893c2272185b2597a2645c Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 00:52:31 -0600 Date: Wed, 2 Mar 2016 00:52:31 -0600
Subject: [PATCH] Lighting Queue Subject: [PATCH] Lighting Queue
@ -6,10 +6,10 @@ Subject: [PATCH] Lighting Queue
This provides option to queue lighting updates to ensure they do not cause the server lag This provides option to queue lighting updates to ensure they do not cause the server lag
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
index 11dd692..da3787d 100644 index 741da72..8b3aa17 100644
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -35,6 +35,8 @@ public class WorldTimingsHandler { @@ -42,6 +42,8 @@ public class WorldTimingsHandler {
public final Timing syncChunkLoadTileTicksTimer; public final Timing syncChunkLoadTileTicksTimer;
public final Timing syncChunkLoadPostTimer; public final Timing syncChunkLoadPostTimer;
@ -18,7 +18,7 @@ index 11dd692..da3787d 100644
public WorldTimingsHandler(World server) { public WorldTimingsHandler(World server) {
String name = server.worldData.getName() +" - "; String name = server.worldData.getName() +" - ";
@@ -67,5 +69,7 @@ public class WorldTimingsHandler { @@ -81,5 +83,7 @@ public class WorldTimingsHandler {
tracker2 = Timings.ofSafe(name + "tracker stage 2"); tracker2 = Timings.ofSafe(name + "tracker stage 2");
doTick = Timings.ofSafe(name + "doTick"); doTick = Timings.ofSafe(name + "doTick");
tickEntities = Timings.ofSafe(name + "tickEntities"); tickEntities = Timings.ofSafe(name + "tickEntities");
@ -222,7 +222,7 @@ index 0000000..2350fe3
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 362df8f..dc51a79 100644 index 8735dd4..ccef663 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -384,7 +384,7 @@ public abstract class World implements IBlockAccess { @@ -384,7 +384,7 @@ public abstract class World implements IBlockAccess {
@ -235,5 +235,5 @@ index 362df8f..dc51a79 100644
} }
-- --
2.8.2.windows.1 2.8.3

View File

@ -1,4 +1,4 @@
From 6f5ba9138ecbe420a790519709c60850d4e89caa Mon Sep 17 00:00:00 2001 From 1c8fae3651381aeb25d7f4af371147a76b6da5f0 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 14:35:27 -0600 Date: Wed, 2 Mar 2016 14:35:27 -0600
Subject: [PATCH] Add player view distance API Subject: [PATCH] Add player view distance API
@ -25,10 +25,10 @@ index 7ef3f62..6e19244 100644
// CraftBukkit start // CraftBukkit start
public String displayName; public String displayName;
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index b0249ff..77e9187 100644 index 797a84f..d554d7d 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -46,7 +46,7 @@ public class PlayerChunkMap { @@ -47,7 +47,7 @@ public class PlayerChunkMap {
private final List<PlayerChunk> g = Lists.newLinkedList(); private final List<PlayerChunk> g = Lists.newLinkedList();
private final List<PlayerChunk> h = Lists.newLinkedList(); private final List<PlayerChunk> h = Lists.newLinkedList();
private final List<PlayerChunk> i = Lists.newArrayList(); private final List<PlayerChunk> i = Lists.newArrayList();
@ -37,7 +37,7 @@ index b0249ff..77e9187 100644
private long k; private long k;
private boolean l = true; private boolean l = true;
private boolean m = true; private boolean m = true;
@@ -288,8 +288,11 @@ public class PlayerChunkMap { @@ -303,8 +303,11 @@ public class PlayerChunkMap {
int i = (int) entityplayer.d >> 4; int i = (int) entityplayer.d >> 4;
int j = (int) entityplayer.e >> 4; int j = (int) entityplayer.e >> 4;
@ -51,7 +51,7 @@ index b0249ff..77e9187 100644
PlayerChunk playerchunk = this.getChunk(k, l); PlayerChunk playerchunk = this.getChunk(k, l);
if (playerchunk != null) { if (playerchunk != null) {
@@ -319,7 +322,9 @@ public class PlayerChunkMap { @@ -334,7 +337,9 @@ public class PlayerChunkMap {
if (d2 >= 64.0D) { if (d2 >= 64.0D) {
int k = (int) entityplayer.d >> 4; int k = (int) entityplayer.d >> 4;
int l = (int) entityplayer.e >> 4; int l = (int) entityplayer.e >> 4;
@ -62,7 +62,7 @@ index b0249ff..77e9187 100644
int j1 = i - k; int j1 = i - k;
int k1 = j - l; int k1 = j - l;
@@ -328,7 +333,7 @@ public class PlayerChunkMap { @@ -343,7 +348,7 @@ public class PlayerChunkMap {
if (j1 != 0 || k1 != 0) { if (j1 != 0 || k1 != 0) {
for (int l1 = i - i1; l1 <= i + i1; ++l1) { for (int l1 = i - i1; l1 <= i + i1; ++l1) {
for (int i2 = j - i1; i2 <= j + i1; ++i2) { for (int i2 = j - i1; i2 <= j + i1; ++i2) {
@ -71,7 +71,7 @@ index b0249ff..77e9187 100644
// this.c(l1, i2).a(entityplayer); // this.c(l1, i2).a(entityplayer);
chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); // CraftBukkit chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); // CraftBukkit
} }
@@ -480,4 +485,20 @@ public class PlayerChunkMap { @@ -495,4 +500,20 @@ public class PlayerChunkMap {
} }
} }
// CraftBukkit end // CraftBukkit end
@ -114,5 +114,5 @@ index 5515958..9770c99 100644
private final Player.Spigot spigot = new Player.Spigot() private final Player.Spigot spigot = new Player.Spigot()
{ {
-- --
2.8.2.windows.1 2.8.3

View File

@ -1,14 +1,14 @@
From 72728a688b1a601363b2d8d47a5c6d9ea29edaf5 Mon Sep 17 00:00:00 2001 From e81998f1d7e8b746800b99873ded73f31db9f51c Mon Sep 17 00:00:00 2001
From: Daniel Ennis <dennis@icontact.com> From: Daniel Ennis <dennis@icontact.com>
Date: Sun, 20 Mar 2016 15:22:42 -0400 Date: Sun, 20 Mar 2016 15:22:42 -0400
Subject: [PATCH] Catch Async PlayerChunkMap operations Subject: [PATCH] Catch Async PlayerChunkMap operations
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 77e9187..6c95e50 100644 index d554d7d..20a8a80 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -422,10 +422,12 @@ public class PlayerChunkMap { @@ -437,10 +437,12 @@ public class PlayerChunkMap {
} }
public void a(PlayerChunk playerchunk) { public void a(PlayerChunk playerchunk) {
@ -22,5 +22,5 @@ index 77e9187..6c95e50 100644
long i = d(chunkcoordintpair.x, chunkcoordintpair.z); long i = d(chunkcoordintpair.x, chunkcoordintpair.z);
-- --
2.8.2 2.8.3