Added max values to metrics.

This commit is contained in:
2023-03-16 12:40:08 -04:00
parent c06da74eec
commit 68ae4604b0
3 changed files with 16 additions and 8 deletions
+6 -1
View File
@@ -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;
} }
} }
+5 -5
View File
@@ -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");
} }
@@ -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;
} }
/* /*