From 92442dcdb919291ea67e5ffb2462ce58fd9247c1 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 26 Sep 2018 13:58:11 -0700 Subject: [PATCH] total accounted time --- .../java/baritone/pathing/calc/AStarPathFinder.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index ea56925d..c6645a5c 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -133,6 +133,9 @@ public final class AStarPathFinder extends AbstractNodeCostSearch implements Hel if (!moves.dynamicXZ) { // only increment the counter if the movement would have gone out of bounds guaranteed numEmptyChunk++; } + long costStart = System.nanoTime(); + chunk += costStart - s; + chunkCount++; continue; } } @@ -215,6 +218,14 @@ public final class AStarPathFinder extends AbstractNodeCostSearch implements Hel int numBlockState = BlockStateInterface.numBlockStateLookups - startVal2; int numSucc = BlockStateInterface.numTimesChunkSucceeded - startVal; long numSuccc = BetterBlockPos.numCreated - startVal3; + + long totalAccountedTimeMS = 0; + totalAccountedTimeMS += heapRemove / 1000000; + totalAccountedTimeMS += heapAdd / 1000000; + totalAccountedTimeMS += heapUpdate / 1000000; + totalAccountedTimeMS += chunk / 1000000; + totalAccountedTimeMS += getNode / 1000000; + totalAccountedTimeMS += goalCheck / 1000000; System.out.println("Out of " + numBlockState + " block state lookups, " + numSucc + " were in the same chunk as the previous and could be cached"); System.out.println("Instantiated " + numSuccc + " BetterBlockPos objects"); System.out.println("Remove " + (heapRemove / heapRemoveCount) + " " + heapRemove / 1000000 + "ms " + heapRemoveCount); @@ -228,10 +239,12 @@ public final class AStarPathFinder extends AbstractNodeCostSearch implements Hel for (Moves move : moves) { int num = count[move.ordinal()]; long nanoTime = timeConsumed[move.ordinal()]; + totalAccountedTimeMS += nanoTime / 1000000; System.out.println(nanoTime / num + " " + move + " " + nanoTime / 1000000 + "ms " + num); System.out.println(stateLookup[move.ordinal()] / num + " " + stateLookup[move.ordinal()]); System.out.println(posCreation[move.ordinal()] / num + " " + posCreation[move.ordinal()]); } + System.out.println("Total accounted time: " + totalAccountedTimeMS); if (cancelRequested) { return Optional.empty(); }