diff --git a/src/engine/ai/MobileFSMManager.java b/src/engine/ai/MobileFSMManager.java index 25727a80..1f89d8c7 100644 --- a/src/engine/ai/MobileFSMManager.java +++ b/src/engine/ai/MobileFSMManager.java @@ -26,7 +26,8 @@ public class MobileFSMManager { private volatile boolean alive; private long timeOfKill = -1; - public static Duration executionTime; + public static Duration executionTime = Duration.ofNanos(1); + public static Duration executionMax = Duration.ofNanos(1); private MobileFSMManager() { @@ -97,6 +98,10 @@ public class MobileFSMManager { } this.executionTime = Duration.between(startTime, Instant.now()); + + if (executionTime.compareTo(executionMax) > 0) + executionMax = executionTime; + mobPulse = System.currentTimeMillis() + MBServerStatics.AI_PULSE_MOB_THRESHOLD; } } diff --git a/src/engine/devcmd/cmds/HeartbeatCmd.java b/src/engine/devcmd/cmds/HeartbeatCmd.java index 7e14164f..a8f891d3 100644 --- a/src/engine/devcmd/cmds/HeartbeatCmd.java +++ b/src/engine/devcmd/cmds/HeartbeatCmd.java @@ -16,9 +16,6 @@ import engine.gameManager.SimulationManager; import engine.objects.AbstractGameObject; import engine.objects.PlayerCharacter; -import java.time.temporal.TemporalUnit; -import java.util.concurrent.TimeUnit; - public class HeartbeatCmd extends AbstractDevCmd { public HeartbeatCmd() { @@ -29,8 +26,11 @@ public class HeartbeatCmd extends AbstractDevCmd { protected void _doCmd(PlayerCharacter pc, String[] words, AbstractGameObject target) { - this.throwbackInfo(pc, "Heartbeat : " + SimulationManager.HeartbeatDelta.getNano() + "ns"); - this.throwbackInfo(pc, "FSM: " + MobileFSMManager.executionTime.getNano() + "ns"); + this.throwbackInfo(pc, "Heartbeat : " + SimulationManager.executionTime.toNanos() + "ns"); + this.throwbackInfo(pc, "Heartbeat Max: " + SimulationManager.executionMax.toNanos() + "ns"); + + this.throwbackInfo(pc, "FSM: " + MobileFSMManager.executionTime.toNanos() + "ns"); + this.throwbackInfo(pc, "FSM max: " + MobileFSMManager.executionMax.toNanos() + "ns"); } diff --git a/src/engine/gameManager/SimulationManager.java b/src/engine/gameManager/SimulationManager.java index aa38194b..ffb00a5d 100644 --- a/src/engine/gameManager/SimulationManager.java +++ b/src/engine/gameManager/SimulationManager.java @@ -41,7 +41,8 @@ public enum SimulationManager { private long _updatePulseTime = System.currentTimeMillis() + UPDATE_PULSE; private long _flightPulseTime = System.currentTimeMillis() + FlIGHT_PULSE; - public static Duration HeartbeatDelta; + public static Duration executionTime = Duration.ofNanos(1); + public static Duration executionMax = Duration.ofNanos(1); private SimulationManager() { @@ -114,8 +115,10 @@ public enum SimulationManager { } - SimulationManager.HeartbeatDelta = Duration.between(startTime, Instant.now()); + SimulationManager.executionTime = Duration.between(startTime, Instant.now()); + if (executionTime.compareTo(executionMax) > 0) + executionMax = executionTime; } /*