(FINAL 1.16.2) Improve Timings support for Active vs Inactive vs Passengers

This makes it so entities that are passengers of other entities no longer count in the parents timings, as well as
tracks them as a separate timers per their tick status.

This lets you see how much time is spent in activated entities vs inactive (as inactive still has to do work)

Passengers is also tracked separately so you can identify "Villagers in Minecarts" vs roaming villagers, as
the lack of ability to move can impact their performance characteristics.

This will likely break any plugin that was naughty and directly messed with our internal timings as this
moves the timings to the EntityTypes object, speeding up creation of Entities to no longer store
a timing handler object per entity.

This will also change the output of the entities in timings to use internal ID's instead of class names.

If a plugin is broken by this, shame them for doing bad things. Paper will not fix it, they will have to fix it.
This commit is contained in:
Aikar
2020-09-10 18:02:39 -04:00
parent 794e6baf14
commit 6fda3fd0ed
41 changed files with 199 additions and 146 deletions

View File

@@ -130,10 +130,10 @@ index ea7527b16571cef5c285e898f5a9fd0c063948fa..df8a92b082139c84afc32cf02541faa8
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game");
cserver.getPluginManager().callEvent(playerQuitEvent);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index f841621a7fe1a2364f821ceb661972d6b03b3b9a..d1699502eac193f25d2fc369526596a0b62574a3 100644
index b62f908886478d09fb5831492d94a6427808ccf7..afefa310800972f2b5f36e6364b9126a13cca5c6 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1005,7 +1005,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -1008,7 +1008,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
for (TileEntity tileentity : chunk.getTileEntities().values()) {
if (tileentity instanceof IInventory) {
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((IInventory) tileentity).getViewers())) {
@@ -142,7 +142,7 @@ index f841621a7fe1a2364f821ceb661972d6b03b3b9a..d1699502eac193f25d2fc369526596a0
}
}
}
@@ -1063,7 +1063,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -1066,7 +1066,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) {
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {