Yatopia/patches/server/0014-Purpur-Add-more-timings-timers.patch
2020-06-27 18:09:09 +02:00

222 lines
12 KiB
Diff

From a2d9601f553355eaf0a3f5d8e9900cd45ccbd0bc Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Tue, 21 Apr 2020 15:49:52 +0200
Subject: [PATCH] Purpur Add more timings timers
---
.../co/aikar/timings/MinecraftTimings.java | 22 +++++++++++++++++++
.../minecraft/server/EntityInsentient.java | 12 ++++++++++
.../net/minecraft/server/EntityLiving.java | 20 ++++++++++++++---
.../server/PathfinderGoalSelector.java | 7 +++++-
.../net/minecraft/server/WorldServer.java | 2 ++
5 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
index 2966c5731..ae5586737 100644
--- a/src/main/java/co/aikar/timings/MinecraftTimings.java
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -45,6 +45,28 @@ public final class MinecraftTimings {
public static final Timing scoreboardScoreSearch = Timings.ofSafe("Scoreboard score search"); // Tuinity - add timings for scoreboard search
+ // Purpur start
+ public static final Timing goalCleanup = Timings.ofSafe("PathfinderGoal - Cleanup");
+ public static final Timing goalUpdate = Timings.ofSafe("PathfinderGoal - Update");
+ public static final Timing goalTick = Timings.ofSafe("PathfinderGoal - Tick");
+
+ public static final Timing entityMovementTick = Timings.ofSafe("Entity Movement");
+ public static final Timing entityMovementTickAI = Timings.ofSafe("Entity Movement - AI");
+ public static final Timing entityMovementTickNewAI = Timings.ofSafe("Entity Movement - New AI");
+ public static final Timing entityMovementTickJump = Timings.ofSafe("Entity Movement - Jump");
+ public static final Timing entityMovementTickTravel = Timings.ofSafe("Entity Movement - Travel");
+ public static final Timing entityMovementTickPush = Timings.ofSafe("Entity Movement - Push");
+
+ public static final Timing entityInsentientSensing = Timings.ofSafe("Entity Insentient - Sensing");
+ public static final Timing entityInsentientTargetSelector = Timings.ofSafe("Entity Insentient - TargetSelector");
+ public static final Timing entityInsentientGoalSelector = Timings.ofSafe("Entity Insentient - GoalSelector");
+ public static final Timing entityInsentientNavigation = Timings.ofSafe("Entity Insentient - Navigation");
+ public static final Timing entityInsentientMobTick = Timings.ofSafe("Entity Insentient - MobTick");
+ public static final Timing entityInsentientControls = Timings.ofSafe("Entity Insentient - Controls");
+
+ public static final Timing passengerTick = Timings.ofSafe("Passenger Tick");
+ // Purpur end
+
private static final Map<Class<?>, String> taskNameCache = new MapMaker().weakKeys().makeMap();
private MinecraftTimings() {}
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index f638b21a3..5466c763e 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -748,21 +748,32 @@ public abstract class EntityInsentient extends EntityLiving {
}
// Paper end
this.world.getMethodProfiler().enter("sensing");
+ co.aikar.timings.MinecraftTimings.entityInsentientSensing.startTiming(); // Purpur
this.bv.a();
+ co.aikar.timings.MinecraftTimings.entityInsentientSensing.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("targetSelector");
+ co.aikar.timings.MinecraftTimings.entityInsentientTargetSelector.startTiming(); // Purpur
this.targetSelector.doTick();
+ co.aikar.timings.MinecraftTimings.entityInsentientTargetSelector.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("goalSelector");
+ co.aikar.timings.MinecraftTimings.entityInsentientGoalSelector.startTiming(); // Purpur
this.goalSelector.doTick();
+ co.aikar.timings.MinecraftTimings.entityInsentientGoalSelector.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("navigation");
+ co.aikar.timings.MinecraftTimings.entityInsentientNavigation.startTiming(); // Purpur
this.navigation.c();
+ co.aikar.timings.MinecraftTimings.entityInsentientNavigation.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("mob tick");
+ co.aikar.timings.MinecraftTimings.entityInsentientMobTick.startTiming(); // Purpur
this.mobTick();
+ co.aikar.timings.MinecraftTimings.entityInsentientMobTick.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("controls");
+ co.aikar.timings.MinecraftTimings.entityInsentientControls.startTiming(); // Purpur
this.world.getMethodProfiler().enter("move");
this.moveController.a();
this.world.getMethodProfiler().exitEnter("look");
@@ -770,6 +781,7 @@ public abstract class EntityInsentient extends EntityLiving {
this.world.getMethodProfiler().exitEnter("jump");
this.bp.b();
this.world.getMethodProfiler().exit();
+ co.aikar.timings.MinecraftTimings.entityInsentientControls.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.M();
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 3b4d2ae5a..617358db7 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2467,7 +2467,11 @@ public abstract class EntityLiving extends Entity {
}
}
- this.movementTick();
+
+ MinecraftTimings.entityMovementTick.startTiming(); // Purpur
+ if (!dead) this.movementTick(); // Purpur
+ MinecraftTimings.entityMovementTick.stopTiming(); // Purpur
+
double d0 = this.locX() - this.lastX;
double d1 = this.locZ() - this.lastZ;
float f = (float) (d0 * d0 + d1 * d1);
@@ -2736,18 +2740,23 @@ public abstract class EntityLiving extends Entity {
this.setMot(d4, d5, d6);
this.world.getMethodProfiler().enter("ai");
+ co.aikar.timings.MinecraftTimings.entityMovementTickAI.startTiming(); // Purpur
if (this.isFrozen()) {
this.jumping = false;
this.aY = 0.0F;
this.ba = 0.0F;
} else if (this.doAITick()) {
this.world.getMethodProfiler().enter("newAi");
+ co.aikar.timings.MinecraftTimings.entityMovementTickNewAI.startTiming(); // Purpur
this.doTick();
+ co.aikar.timings.MinecraftTimings.entityMovementTickNewAI.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
}
+ co.aikar.timings.MinecraftTimings.entityMovementTickAI.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("jump");
+ co.aikar.timings.MinecraftTimings.entityMovementTickJump.startTiming(); // Purpur
if (this.jumping && this.cS()) {
double d7;
@@ -2773,21 +2782,26 @@ public abstract class EntityLiving extends Entity {
} else {
this.jumpTicks = 0;
}
+ co.aikar.timings.MinecraftTimings.entityMovementTickJump.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("travel");
- this.aY *= 0.98F;
- this.ba *= 0.98F;
+ co.aikar.timings.MinecraftTimings.entityMovementTickTravel.startTiming(); // Purpur
+ this.aZ *= 0.98F;
+ this.bb *= 0.98F;
this.t();
AxisAlignedBB axisalignedbb = this.getBoundingBox();
this.f(new Vec3D((double) this.aY, (double) this.aZ, (double) this.ba));
+ co.aikar.timings.MinecraftTimings.entityMovementTickTravel.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("push");
+ co.aikar.timings.MinecraftTimings.entityMovementTickPush.startTiming(); // Purpur
if (this.bm > 0) {
--this.bm;
this.a(axisalignedbb, this.getBoundingBox());
}
+ co.aikar.timings.MinecraftTimings.entityMovementTickPush.stopTiming(); // Purpur
this.collideNearby();
this.world.getMethodProfiler().exit();
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
index d3f0327a2..cce7cac92 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -80,7 +80,7 @@ public class PathfinderGoalSelector {
public void doTick() {
GameProfilerFiller gameprofilerfiller = (GameProfilerFiller) this.e.get();
-
+ co.aikar.timings.MinecraftTimings.goalCleanup.startTiming();
gameprofilerfiller.enter("goalCleanup");
// Paper start - remove streams from pathfindergoalselector
for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
@@ -100,8 +100,10 @@ public class PathfinderGoalSelector {
}
});
+ co.aikar.timings.MinecraftTimings.goalCleanup.stopTiming();
gameprofilerfiller.exit();
gameprofilerfiller.enter("goalUpdate");
+ co.aikar.timings.MinecraftTimings.goalUpdate.startTiming();
// Paper start - remove streams from pathfindergoalselector
goal_update_loop: for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
PathfinderGoalWrapped wrappedGoal = iterator.next();
@@ -144,8 +146,10 @@ public class PathfinderGoalSelector {
wrappedGoal.c();
}
// Paper end - remove streams from pathfindergoalselector
+ co.aikar.timings.MinecraftTimings.goalUpdate.stopTiming();
gameprofilerfiller.exit();
gameprofilerfiller.enter("goalTick");
+ co.aikar.timings.MinecraftTimings.goalTick.startTiming();
// Paper start - remove streams from pathfindergoalselector
for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
PathfinderGoalWrapped wrappedGoal = iterator.next();
@@ -155,6 +159,7 @@ public class PathfinderGoalSelector {
}
// Paper end - remove streams from pathfindergoalselector
gameprofilerfiller.exit();
+ co.aikar.timings.MinecraftTimings.goalTick.stopTiming();
}
public final Stream<PathfinderGoalWrapped> getExecutingGoals() { return d(); } // Paper - OBFHELPER
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 908df99f3..ad3326fa9 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1326,7 +1326,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
return IRegistry.ENTITY_TYPE.getKey(entity1.getEntityType()).toString();
});
gameprofilerfiller.c("tickPassenger");
+ co.aikar.timings.MinecraftTimings.passengerTick.startTiming(); // Purpur
entity1.passengerTick();
+ co.aikar.timings.MinecraftTimings.passengerTick.stopTiming(); // Purpur
gameprofilerfiller.exit();
}
--
2.25.1.windows.1