Skip to content

Commit

Permalink
Hack in some better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cam72cam committed Oct 5, 2023
1 parent c88884c commit da7a010
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,13 @@ public static void iterate(Map<UUID, SimulationState> states, Map<UUID, Simulati
for (Particle particle : consist) {
nextStateMap.put(particle.state.config.id, particle.state.next());
}
Simulation.restStates += consist.size();
} else {
if (dirty || missingNextStates) {
particles.addAll(consist);
Simulation.calculatedStates += consist.size();
} else {
Simulation.keptStates += consist.size();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
public class Simulation {

public static boolean forceQuickUpdates = false;
public static int calculatedStates;
public static int restStates;
public static int keptStates;

public static void simulate(World world) {
// 100KM/h ~= 28m/s which means non-loaded stationary stock may be phased through at that speed
Expand Down Expand Up @@ -45,6 +48,9 @@ public static void simulate(World world) {
}

long startMs = System.currentTimeMillis();
calculatedStates = 0;
restStates = 0;
keptStates = 0;

int pass = (int) ChronoState.getState(world).getTickID();

Expand Down Expand Up @@ -293,12 +299,12 @@ This can happen when a piece of stock is marked dirty (discard existing states e

long iterationMs = System.currentTimeMillis() - startIterationMs;
if (iterationMs > Config.ConfigDebug.physicsWarnThresholdMs) {
ImmersiveRailroading.warn("Calculating Immersive Railroading Physics Iteration took %sms (dirty: %s)", iterationMs, anyStartedDirty);
ImmersiveRailroading.warn("Calculating Immersive Railroading Physics Iteration took %sms (dirty: %s, %s, %s, %s)", iterationMs, anyStartedDirty, calculatedStates, restStates, keptStates);
}
}
long totalMs = System.currentTimeMillis() - startMs;
if (totalMs > Config.ConfigDebug.physicsWarnTotalThresholdMs) {
ImmersiveRailroading.warn("Calculating Immersive Railroading Physics took %sms : %sms (dirty: %s)", totalMs, System.currentTimeMillis() - startStatesMs, anyStartedDirty);
ImmersiveRailroading.warn("Calculating Immersive Railroading Physics took %sms : %sms (dirty: %s, %s, %s, %s)", totalMs, System.currentTimeMillis() - startStatesMs, anyStartedDirty, calculatedStates, restStates, keptStates);
}

boolean sendPackets = world.getTicks() % 20 == 0 || anyStartedDirty;
Expand Down

0 comments on commit da7a010

Please sign in to comment.