@Override protected DataReader importData() throws IOException { StopWatch sw = new StopWatch().start(); DataReader dr = super.importData(); put("graph.import_time", sw.stop().getSeconds()); return dr; } };
/** * @return the time it took to extract the path in nano (!) seconds */ public long getExtractTime() { return extractSW.getNanos(); }
public String getDebugInfo() { return extractSW.toString(); }
/** * This method removes networks that will be never be visited by this filter. See #235 for * example, small areas like parking lots are sometimes connected to the whole network through a * one-way road. This is clearly an error - but is causes the routing to fail when a point gets * connected to this small area. This routine removes all these networks from the graph. * <p> * * @return number of removed edges */ int removeDeadEndUnvisitedNetworks(final PrepEdgeFilter bothFilter) { StopWatch sw = new StopWatch(bothFilter.getEncoder() + " findComponents").start(); final EdgeFilter outFilter = DefaultEdgeFilter.outEdges(bothFilter.getEncoder()); // partition graph into strongly connected components using Tarjan's algorithm TarjansSCCAlgorithm tarjan = new TarjansSCCAlgorithm(ghStorage, outFilter, true); List<IntArrayList> components = tarjan.findComponents(); logger.info(sw.stop() + ", size:" + components.size()); return removeEdges(bothFilter, components, minOneWayNetworkSize); }
private boolean prepareNodes() { int nodes = prepareGraph.getNodes(); for (int node = 0; node < nodes; node++) { prepareGraph.setLevel(node, maxLevel); } periodicUpdateSW.start(); for (int node = 0; node < nodes; node++) { float priority = oldPriorities[node] = calculatePriority(node); sortedNodes.insert(node, priority); } periodicUpdateSW.stop(); return !sortedNodes.isEmpty(); }
@Override public void doSpecificWork() { allSW.start(); initFromGraph(); runGraphContraction(); logger.info("took:" + (int) allSW.stop().getSeconds() + "s " + ", new shortcuts: " + nf(nodeContractor.getAddedShortcutsCount()) + ", initSize:" + nf(initSize) + ", " + prepareWeighting + ", periodic:" + params.getPeriodicUpdatesPercentage() + ", lazy:" + params.getLastNodesLazyUpdatePercentage() + ", neighbor:" + params.getNeighborUpdatePercentage() + ", " + getTimesAsString() + ", lazy-overhead: " + (int) (100 * ((checkCounter / (double) initSize) - 1)) + "%" + ", " + Helper.getMemInfo()); int edgeCount = prepareGraph.getOriginalEdges(); logger.info("graph now - num edges: {}, num nodes: {}, num shortcuts: {}", nf(edgeCount), nf(prepareGraph.getNodes()), nf(prepareGraph.getEdges() - edgeCount)); }
@Override public String toString() { String str = ""; if (!Helper.isEmpty(name)) { str += name + " "; } return str + "time:" + getSeconds(); }
double toLat = mg.getLat(e.getY()); double toLon = mg.getLon(e.getX()); StopWatch sw = new StopWatch().start(); logger.info("start searching from " + fromLat + "," + fromLon + " to " + toLat + "," + toLon);
@Override public void doWork() { if (prepareFlagEncoder == null) throw new IllegalStateException("No vehicle encoder set."); if (prepareWeighting == null) throw new IllegalStateException("No weight calculation set."); allSW.start(); super.doWork(); initFromGraph(); if (!prepareNodes()) return; contractNodes(); }
/** * Extracts the Path from the shortest-path-tree determined by sptEntry. */ public Path extract() { if (isFound()) throw new IllegalStateException("Extract can only be called once"); extractSW.start(); SPTEntry currEdge = sptEntry; setEndNode(currEdge.adjNode); boolean nextEdgeValid = EdgeIterator.Edge.isValid(currEdge.edge); int nextEdge; while (nextEdgeValid) { // the reverse search needs the next edge nextEdgeValid = EdgeIterator.Edge.isValid(currEdge.parent.edge); nextEdge = nextEdgeValid ? currEdge.parent.edge : EdgeIterator.NO_EDGE; processEdge(currEdge.edge, currEdge.adjNode, nextEdge); currEdge = currEdge.parent; } setFromNode(currEdge.adjNode); reverseOrder(); extractSW.stop(); return setFound(true); }
@Override protected void prepareCH() { StopWatch sw = new StopWatch().start(); super.prepareCH(); put(Parameters.CH.PREPARE + "time", sw.stop().getMillis()); int edges = getGraphHopperStorage().getAllEdges().length(); if (getCHFactoryDecorator().hasWeightings()) { Weighting weighting = getCHFactoryDecorator().getWeightings().get(0); int edgesAndShortcuts = getGraphHopperStorage().getGraph(CHGraph.class, weighting).getEdges(); put(Parameters.CH.PREPARE + "shortcuts", edgesAndShortcuts - edges); } }
/** * This method removes networks that will be never be visited by this filter. See #235 for * example, small areas like parking lots are sometimes connected to the whole network through a * one-way road. This is clearly an error - but is causes the routing to fail when a point gets * connected to this small area. This routine removes all these networks from the graph. * <p> * * @return number of removed edges */ int removeDeadEndUnvisitedNetworks(final PrepEdgeFilter bothFilter) { StopWatch sw = new StopWatch(bothFilter.getEncoder() + " findComponents").start(); final EdgeFilter outFilter = DefaultEdgeFilter.outEdges(bothFilter.getEncoder()); // partition graph into strongly connected components using Tarjan's algorithm TarjansSCCAlgorithm tarjan = new TarjansSCCAlgorithm(ghStorage, outFilter, true); List<IntArrayList> components = tarjan.findComponents(); logger.info(sw.stop() + ", size:" + components.size()); return removeEdges(bothFilter, components, minOneWayNetworkSize); }
@Override public void doSpecificWork() { allSW.start(); initFromGraph(); runGraphContraction(); logger.info("took:" + (int) allSW.stop().getSeconds() + "s " + ", new shortcuts: " + nf(nodeContractor.getAddedShortcutsCount()) + ", initSize:" + nf(initSize) + ", " + prepareWeighting + ", periodic:" + params.getPeriodicUpdatesPercentage() + ", lazy:" + params.getLastNodesLazyUpdatePercentage() + ", neighbor:" + params.getNeighborUpdatePercentage() + ", " + getTimesAsString() + ", lazy-overhead: " + (int) (100 * ((checkCounter / (double) initSize) - 1)) + "%" + ", " + Helper.getMemInfo()); int edgeCount = ghStorage.getAllEdges().length(); logger.info("graph now - num edges: {}, num nodes: {}, num shortcuts: {}", nf(edgeCount), nf(ghStorage.getNodes()), nf(prepareGraph.getAllEdges().length() - edgeCount)); }
@Override public String toString() { String str = ""; if (!Helper.isEmpty(name)) { str += name + " "; } return str + "time:" + getSeconds(); }
StopWatch sw = new StopWatch().start(); logger.info("start searching with " + algo + " from:" + fromRes + " to:" + toRes + " " + weighting);
@Override public void doWork() { if (prepareWeighting == null) throw new IllegalStateException("No weight calculation set."); allSW.start(); super.doWork(); initFromGraph(); if (!prepareNodes()) return; contractNodes(); }
@Override public void readGraph() throws IOException { if (encodingManager == null) throw new IllegalStateException("Encoding manager was not set."); if (osmFile == null) throw new IllegalStateException("No OSM file specified"); if (!osmFile.exists()) throw new IllegalStateException("Your specified OSM file does not exist:" + osmFile.getAbsolutePath()); StopWatch sw1 = new StopWatch().start(); preProcess(osmFile); sw1.stop(); StopWatch sw2 = new StopWatch().start(); writeOsm2Graph(osmFile); sw2.stop(); LOGGER.info("time pass1:" + (int) sw1.getSeconds() + "s, " + "pass2:" + (int) sw2.getSeconds() + "s, " + "total:" + (int) (sw1.getSeconds() + sw2.getSeconds()) + "s"); }
periodicUpdateSW.start(); sortedNodes.clear(); for (int node = 0; node < prepareGraph.getNodes(); node++) { periodicUpdateSW.stop(); updateCounter++; if (sortedNodes.isEmpty()) lazyUpdateSW.start(); float priority = oldPriorities[polledNode] = calculatePriority(polledNode); if (priority > sortedNodes.peekValue()) { lazyUpdateSW.stop(); continue; lazyUpdateSW.stop(); contractionSW.start(); nodeContractor.contractNode(polledNode); prepareGraph.setLevel(polledNode, level); level++; contractionSW.stop(); neighborUpdateSW.start(); float oldPrio = oldPriorities[nn]; float priority = oldPriorities[nn] = calculatePriority(nn); neighborUpdateSW.stop();
@Override protected void prepareCH() { StopWatch sw = new StopWatch().start(); super.prepareCH(); put(Parameters.CH.PREPARE + "time", sw.stop().getMillis()); StopWatch sw = new StopWatch().start(); super.loadOrPrepareLM(); put(Parameters.Landmark.PREPARE + "time", sw.stop().getMillis()); StopWatch sw = new StopWatch().start(); DataReader dr = super.importData(); put("graph.import_time", sw.stop().getSeconds()); FlagEncoder encoder = hopper.getEncodingManager().getEncoder(vehicleStr); StopWatch sw = new StopWatch().start(); try { maxNode = g.getNodes(); put("measurement.count", count); put("measurement.seed", seed); put("measurement.time", sw.stop().getMillis()); System.gc(); put("measurement.totalMB", getTotalMB());