mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-06 02:42:34 +01:00
219 lines
12 KiB
Diff
219 lines
12 KiB
Diff
From 48c1f65d7ee60e9ee875f754d854bcb8b5cbbf91 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 | 16 +++++++++++++-
|
|
.../server/PathfinderGoalSelector.java | 6 +++++
|
|
.../net/minecraft/server/WorldServer.java | 2 ++
|
|
5 files changed, 57 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
|
|
index fdb135fa3f..00423cc3af 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 eec4343741..916deddd7e 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
@@ -677,21 +677,32 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
}
|
|
// Paper end
|
|
this.world.getMethodProfiler().enter("sensing");
|
|
+ co.aikar.timings.MinecraftTimings.entityInsentientSensing.startTiming(); // Purpur
|
|
this.bw.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");
|
|
@@ -699,6 +710,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
this.world.getMethodProfiler().exitEnter("jump");
|
|
this.bq.b();
|
|
this.world.getMethodProfiler().exit();
|
|
+ co.aikar.timings.MinecraftTimings.entityInsentientControls.stopTiming(); // Purpur
|
|
this.world.getMethodProfiler().exit();
|
|
this.K();
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 9ff9e9be2b..418fe5909d 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -2413,7 +2413,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);
|
|
@@ -2620,18 +2624,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.aZ = 0.0F;
|
|
this.bb = 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) {
|
|
if (this.N > 0.0D && (!this.onGround || this.N > 0.4D)) {
|
|
this.c(TagsFluid.WATER);
|
|
@@ -2646,21 +2655,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");
|
|
+ co.aikar.timings.MinecraftTimings.entityMovementTickTravel.startTiming(); // Purpur
|
|
this.aZ *= 0.98F;
|
|
this.bb *= 0.98F;
|
|
this.n();
|
|
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
|
|
|
this.e(new Vec3D((double) this.aZ, (double) this.ba, (double) this.bb));
|
|
+ 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.bn > 0) {
|
|
--this.bn;
|
|
this.a(axisalignedbb, this.getBoundingBox());
|
|
}
|
|
+ co.aikar.timings.MinecraftTimings.entityMovementTickPush.stopTiming(); // Purpur
|
|
|
|
if(!de.tr7zw.yapfa.YapfaConfig.disableEntityCollisions) // YAPFA
|
|
this.collideNearby();
|
|
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
|
index a68fc11ec6..95dde66531 100644
|
|
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
|
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
|
@@ -78,6 +78,7 @@ public class PathfinderGoalSelector {
|
|
private static final PathfinderGoal.Type[] PATHFINDER_GOAL_TYPES = PathfinderGoal.Type.values(); // Paper - remove streams from pathfindergoalselector
|
|
|
|
public void doTick() {
|
|
+ co.aikar.timings.MinecraftTimings.goalCleanup.startTiming();
|
|
this.e.enter("goalCleanup");
|
|
// Paper start - remove streams from pathfindergoalselector
|
|
for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
|
|
@@ -97,8 +98,10 @@ public class PathfinderGoalSelector {
|
|
}
|
|
|
|
});
|
|
+ co.aikar.timings.MinecraftTimings.goalCleanup.stopTiming();
|
|
this.e.exit();
|
|
this.e.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();
|
|
@@ -141,8 +144,10 @@ public class PathfinderGoalSelector {
|
|
wrappedGoal.c();
|
|
}
|
|
// Paper end - remove streams from pathfindergoalselector
|
|
+ co.aikar.timings.MinecraftTimings.goalUpdate.stopTiming();
|
|
this.e.exit();
|
|
this.e.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();
|
|
@@ -151,6 +156,7 @@ public class PathfinderGoalSelector {
|
|
}
|
|
}
|
|
// Paper end - remove streams from pathfindergoalselector
|
|
+ co.aikar.timings.MinecraftTimings.goalTick.stopTiming();
|
|
this.e.exit();
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index e1de2edd02..63e23a840b 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -871,7 +871,9 @@ public class WorldServer extends World {
|
|
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
|
|
|