Test new dbg format

This commit is contained in:
Victor Shcherb 2019-08-05 15:24:26 +02:00
parent d62494a8c4
commit f7278f731f
5 changed files with 14 additions and 4 deletions

View file

@ -92,7 +92,7 @@ public class RoutingContext {
long timeToLoad = 0; long timeToLoad = 0;
long timeToLoadHeaders = 0; long timeToLoadHeaders = 0;
long timeToFindInitialSegments = 0; long timeToFindInitialSegments = 0;
long timeToCalculate = 0; public long timeToCalculate = 0;
int distinctLoadedTiles = 0; int distinctLoadedTiles = 0;
int maxLoadedTiles = 0; int maxLoadedTiles = 0;

View file

@ -2911,7 +2911,7 @@
<string name="error_calculating_route">Could not calculate route</string> <string name="error_calculating_route">Could not calculate route</string>
<string name="error_calculating_route_occured">Could not calculate route</string> <string name="error_calculating_route_occured">Could not calculate route</string>
<string name="empty_route_calculated">Calculated route is empty</string> <string name="empty_route_calculated">Calculated route is empty</string>
<string name="new_route_calculated_dist_dbg">Route calculated (internal): distance %s, router time %s (%d tiles, %d segments)</string> <string name="new_route_calculated_dist_dbg">Route calculated (internal): distance %s, router time %s (%.1f sec, %d tiles, %d roads)</string>
<string name="arrived_at_destination">You have arrived at your destination</string> <string name="arrived_at_destination">You have arrived at your destination</string>
<string name="invalid_locations">Invalid coordinates</string> <string name="invalid_locations">Invalid coordinates</string>
<string name="go_back_to_osmand">Go back to OsmAnd map</string> <string name="go_back_to_osmand">Go back to OsmAnd map</string>

View file

@ -42,6 +42,7 @@ public class RouteCalculationResult {
private final float routingTime; private final float routingTime;
private final int visitedSegments; private final int visitedSegments;
private final int loadedTiles; private final int loadedTiles;
private final float calculateTime;
protected int cacheCurrentTextDirectionInfo = -1; protected int cacheCurrentTextDirectionInfo = -1;
protected List<RouteDirectionInfo> cacheAgreggatedDirections; protected List<RouteDirectionInfo> cacheAgreggatedDirections;
@ -61,6 +62,7 @@ public class RouteCalculationResult {
this.routingTime = 0; this.routingTime = 0;
this.loadedTiles = 0; this.loadedTiles = 0;
this.visitedSegments = 0; this.visitedSegments = 0;
this.calculateTime = 0;
this.intermediatePoints = new int[0]; this.intermediatePoints = new int[0];
this.locations = new ArrayList<Location>(); this.locations = new ArrayList<Location>();
this.segments = new ArrayList<RouteSegmentResult>(); this.segments = new ArrayList<RouteSegmentResult>();
@ -72,6 +74,7 @@ public class RouteCalculationResult {
public RouteCalculationResult(List<Location> list, List<RouteDirectionInfo> directions, RouteCalculationParams params, List<LocationPoint> waypoints, boolean addMissingTurns) { public RouteCalculationResult(List<Location> list, List<RouteDirectionInfo> directions, RouteCalculationParams params, List<LocationPoint> waypoints, boolean addMissingTurns) {
this.routingTime = 0; this.routingTime = 0;
this.loadedTiles = 0; this.loadedTiles = 0;
this.calculateTime = 0;
this.visitedSegments = 0; this.visitedSegments = 0;
this.errorMessage = null; this.errorMessage = null;
this.intermediatePoints = new int[params.intermediates == null ? 0 : params.intermediates.size()]; this.intermediatePoints = new int[params.intermediates == null ? 0 : params.intermediates.size()];
@ -106,6 +109,7 @@ public class RouteCalculationResult {
this.routingTime = rctx.routingTime; this.routingTime = rctx.routingTime;
this.visitedSegments = rctx.visitedSegments; this.visitedSegments = rctx.visitedSegments;
this.loadedTiles = rctx.loadedTiles; this.loadedTiles = rctx.loadedTiles;
this.calculateTime = (float) (((System.nanoTime() - rctx.timeToCalculate) / 1e6) / 1000f);
if(waypoints != null) { if(waypoints != null) {
this.locationPoints.addAll(waypoints); this.locationPoints.addAll(waypoints);
} }
@ -822,6 +826,10 @@ public class RouteCalculationResult {
return visitedSegments; return visitedSegments;
} }
public float getCalculateTime() {
return calculateTime;
}
public int getLoadedTiles() { public int getLoadedTiles() {
return loadedTiles; return loadedTiles;
} }

View file

@ -734,7 +734,9 @@ public class RoutingHelper {
if (showToast.value && OsmandPlugin.isDevelopment()) { if (showToast.value && OsmandPlugin.isDevelopment()) {
String msg = app.getString(R.string.new_route_calculated_dist_dbg, String msg = app.getString(R.string.new_route_calculated_dist_dbg,
OsmAndFormatter.getFormattedDistance(res.getWholeDistance(), app), 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); app.showToastMessage(msg);
} }
} }