Browse Source

Added max values to metrics.

master
MagicBot 2 years ago
parent
commit
68ae4604b0
  1. 7
      src/engine/ai/MobileFSMManager.java
  2. 10
      src/engine/devcmd/cmds/HeartbeatCmd.java
  3. 7
      src/engine/gameManager/SimulationManager.java

7
src/engine/ai/MobileFSMManager.java

@ -26,7 +26,8 @@ public class MobileFSMManager {
private volatile boolean alive; private volatile boolean alive;
private long timeOfKill = -1; private long timeOfKill = -1;
public static Duration executionTime; public static Duration executionTime = Duration.ofNanos(1);
public static Duration executionMax = Duration.ofNanos(1);
private MobileFSMManager() { private MobileFSMManager() {
@ -97,6 +98,10 @@ public class MobileFSMManager {
} }
this.executionTime = Duration.between(startTime, Instant.now()); this.executionTime = Duration.between(startTime, Instant.now());
if (executionTime.compareTo(executionMax) > 0)
executionMax = executionTime;
mobPulse = System.currentTimeMillis() + MBServerStatics.AI_PULSE_MOB_THRESHOLD; mobPulse = System.currentTimeMillis() + MBServerStatics.AI_PULSE_MOB_THRESHOLD;
} }
} }

10
src/engine/devcmd/cmds/HeartbeatCmd.java

@ -16,9 +16,6 @@ import engine.gameManager.SimulationManager;
import engine.objects.AbstractGameObject; import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
import java.time.temporal.TemporalUnit;
import java.util.concurrent.TimeUnit;
public class HeartbeatCmd extends AbstractDevCmd { public class HeartbeatCmd extends AbstractDevCmd {
public HeartbeatCmd() { public HeartbeatCmd() {
@ -29,8 +26,11 @@ public class HeartbeatCmd extends AbstractDevCmd {
protected void _doCmd(PlayerCharacter pc, String[] words, protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) { AbstractGameObject target) {
this.throwbackInfo(pc, "Heartbeat : " + SimulationManager.HeartbeatDelta.getNano() + "ns"); this.throwbackInfo(pc, "Heartbeat : " + SimulationManager.executionTime.toNanos() + "ns");
this.throwbackInfo(pc, "FSM: " + MobileFSMManager.executionTime.getNano() + "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");
} }

7
src/engine/gameManager/SimulationManager.java

@ -41,7 +41,8 @@ public enum SimulationManager {
private long _updatePulseTime = System.currentTimeMillis() + UPDATE_PULSE; private long _updatePulseTime = System.currentTimeMillis() + UPDATE_PULSE;
private long _flightPulseTime = System.currentTimeMillis() + FlIGHT_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() { 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;
} }
/* /*

Loading…
Cancel
Save