From f7278f731f08c91dd739848694a602273c55d592 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 5 Aug 2019 15:24:26 +0200 Subject: [PATCH] Test new dbg format --- .../main/java/net/osmand/router/BinaryRoutePlanner.java | 2 +- .../src/main/java/net/osmand/router/RoutingContext.java | 2 +- OsmAnd/res/values/strings.xml | 2 +- .../net/osmand/plus/routing/RouteCalculationResult.java | 8 ++++++++ OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java | 4 +++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java index 2790a3b678..59d41c4688 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java @@ -372,7 +372,7 @@ public class BinaryRoutePlanner { TLongObjectHashMap visitedDirectSegments,TLongObjectHashMap visitedOppositeSegments) { printInfo("Time to calculate : " + (System.nanoTime() - ctx.timeToCalculate) / 1e6 + ", time to load : " + ctx.timeToLoad / 1e6 + ", time to load headers : " + ctx.timeToLoadHeaders / 1e6 + - ", time to calc dev : " + ctx.timeNanoToCalcDeviation/ 1e6); + ", time to calc dev : " + ctx.timeNanoToCalcDeviation / 1e6); int maxLoadedTiles = Math.max(ctx.maxLoadedTiles, ctx.getCurrentlyLoadedTiles()); printInfo("Current loaded tiles : " + ctx.getCurrentlyLoadedTiles() + ", maximum loaded tiles " + maxLoadedTiles); printInfo("Loaded tiles " + ctx.loadedTiles + " (distinct " + ctx.distinctLoadedTiles + "), unloaded tiles " + ctx.unloadedTiles + diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java b/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java index bd85a61265..c048e545f2 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java @@ -92,7 +92,7 @@ public class RoutingContext { long timeToLoad = 0; long timeToLoadHeaders = 0; long timeToFindInitialSegments = 0; - long timeToCalculate = 0; + public long timeToCalculate = 0; int distinctLoadedTiles = 0; int maxLoadedTiles = 0; diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 846a39be8c..1aa73ea8f0 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2911,7 +2911,7 @@ Could not calculate route Could not calculate route Calculated route is empty - Route calculated (internal): distance %s, router time %s (%d tiles, %d segments) + Route calculated (internal): distance %s, router time %s (%.1f sec, %d tiles, %d roads) You have arrived at your destination Invalid coordinates Go back to OsmAnd map diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java index eb84e2f0d7..c181406ab4 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java @@ -42,6 +42,7 @@ public class RouteCalculationResult { private final float routingTime; private final int visitedSegments; private final int loadedTiles; + private final float calculateTime; protected int cacheCurrentTextDirectionInfo = -1; protected List cacheAgreggatedDirections; @@ -61,6 +62,7 @@ public class RouteCalculationResult { this.routingTime = 0; this.loadedTiles = 0; this.visitedSegments = 0; + this.calculateTime = 0; this.intermediatePoints = new int[0]; this.locations = new ArrayList(); this.segments = new ArrayList(); @@ -72,6 +74,7 @@ public class RouteCalculationResult { public RouteCalculationResult(List list, List directions, RouteCalculationParams params, List waypoints, boolean addMissingTurns) { this.routingTime = 0; this.loadedTiles = 0; + this.calculateTime = 0; this.visitedSegments = 0; this.errorMessage = null; this.intermediatePoints = new int[params.intermediates == null ? 0 : params.intermediates.size()]; @@ -106,6 +109,7 @@ public class RouteCalculationResult { this.routingTime = rctx.routingTime; this.visitedSegments = rctx.visitedSegments; this.loadedTiles = rctx.loadedTiles; + this.calculateTime = (float) (((System.nanoTime() - rctx.timeToCalculate) / 1e6) / 1000f); if(waypoints != null) { this.locationPoints.addAll(waypoints); } @@ -822,6 +826,10 @@ public class RouteCalculationResult { return visitedSegments; } + public float getCalculateTime() { + return calculateTime; + } + public int getLoadedTiles() { return loadedTiles; } diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 8fb8fa15a2..b07460537c 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -734,7 +734,9 @@ public class RoutingHelper { if (showToast.value && OsmandPlugin.isDevelopment()) { String msg = app.getString(R.string.new_route_calculated_dist_dbg, OsmAndFormatter.getFormattedDistance(res.getWholeDistance(), app), - ((int)res.getRoutingTime()) + " sec", res.getVisitedSegments(), res.getLoadedTiles()); + + ((int)res.getRoutingTime()) + " sec", + res.getCalculateTime(), res.getVisitedSegments(), res.getLoadedTiles()); app.showToastMessage(msg); } }