@Override public String toString() { String str = ""; if (!Helper.isEmpty(name)) { str += name + " "; } return str + "time:" + getSeconds(); }
@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"); }
+ ", routing errors:" + routingErrorCounter.get() + ", http errors:" + httpErrorCounter.get()); logger.info("took:" + sw.getSeconds()); logger.info("throughput queries/sec:" + successfullQueries.get() / sw.getSeconds()); logger.info("mean query time in sec:" + sw.getSeconds() / successfullQueries.get());
void repaintRoads() { // avoid threading as there should be no updated to scale or offset while painting // (would to lead to artifacts) StopWatch sw = new StopWatch().start(); pathLayer.repaint(); roadsLayer.repaint(); mainPanel.repaint(); logger.info("roads painting took " + sw.stop().getSeconds() + " sec"); } }
logger.info("took: " + sw.getSeconds() + ", visited nodes:" + isochrone.getVisitedNodes() + ", " + uriInfo.getQueryParameters()); return Response.fromResponse(jsonSuccessResponse(buckets, sw.getSeconds())) .header("X-GH-Took", "" + sw.getSeconds() * 1000) .build(); } else if ("polygon".equalsIgnoreCase(resultStr)) { logger.info("took: " + sw.getSeconds() + ", visited nodes:" + isochrone.getVisitedNodes() + ", " + uriInfo.getQueryParameters()); return Response.fromResponse(jsonSuccessResponse(features, sw.getSeconds())) .header("X-GH-Took", "" + sw.getSeconds() * 1000) .build(); } else {
GHResponse route() { StopWatch stopWatch = new StopWatch().start(); ArrayList<QueryResult> allQueryResults = new ArrayList<>(); QueryResult source = findClosest(enter, 0); QueryResult dest = findClosest(exit, 1); allQueryResults.add(source); allQueryResults.add(dest); queryGraph.lookup(Arrays.asList(source, dest)); // modifies queryGraph, source and dest! PointList startAndEndpoint = pointListFrom(Arrays.asList(source, dest)); response.addDebugInfo("idLookup:" + stopWatch.stop().getSeconds() + "s"); int startNode; int destNode; if (arriveBy) { startNode = allQueryResults.get(1).getClosestNode(); destNode = allQueryResults.get(0).getClosestNode(); } else { startNode = allQueryResults.get(0).getClosestNode(); destNode = allQueryResults.get(1).getClosestNode(); } List<List<Label.Transition>> solutions = findPaths(startNode, destNode); parseSolutionsAndAddToResponse(solutions, startAndEndpoint); return response; }
float took = sw.stop().getSeconds(); String infoStr = httpReq.getRemoteAddr() + " " + httpReq.getLocale() + " " + httpReq.getHeader("User-Agent"); String logStr = httpReq.getQueryString() + " " + infoStr + " " + requestPoints + ", took:"
response.addDebugInfo("routing:" + stopWatch.stop().getSeconds() + "s"); if (discoveredSolutions.isEmpty() && router.getVisitedNodes() >= maxVisitedNodesForRequest) { throw new IllegalArgumentException("No path found - maximum number of nodes exceeded: " + maxVisitedNodesForRequest);
@Override protected DataReader importData() throws IOException { StopWatch sw = new StopWatch().start(); DataReader dr = super.importData(); put("graph.import_time", sw.stop().getSeconds()); return dr; } };
private void interpolateBridgesAndOrTunnels() { if (ghStorage.getEncodingManager().supports("generic")) { final FlagEncoder genericFlagEncoder = ghStorage.getEncodingManager() .getEncoder("generic"); if (!(genericFlagEncoder instanceof DataFlagEncoder)) { throw new IllegalStateException("'generic' flag encoder for elevation interpolation of " + "bridges and tunnels is enabled but does not have the expected type " + DataFlagEncoder.class.getName() + "."); } final DataFlagEncoder dataFlagEncoder = (DataFlagEncoder) genericFlagEncoder; StopWatch sw = new StopWatch().start(); new TunnelElevationInterpolator(ghStorage, dataFlagEncoder).execute(); float tunnel = sw.stop().getSeconds(); sw = new StopWatch().start(); new BridgeElevationInterpolator(ghStorage, dataFlagEncoder).execute(); logger.info("Bridge interpolation " + (int) sw.stop().getSeconds() + "s, " + "tunnel interpolation " + (int) tunnel + "s"); } }
@Override public void doSpecificWork() { StopWatch sw = new StopWatch().start(); LOGGER.info("Start calculating " + lms.getLandmarkCount() + " landmarks, default active lms:" + defaultActiveLandmarks + ", weighting:" + lms.getLmSelectionWeighting() + ", " + Helper.getMemInfo()); lms.createLandmarks(); lms.flush(); LOGGER.info("Calculated landmarks for " + (lms.getSubnetworksWithLandmarks() - 1) + " subnetworks, took:" + sw.stop().getSeconds() + " => " + lms.getLandmarksAsGeoJSON() + ", stored weights:" + lms.getLandmarkCount() + ", nodes:" + graph.getNodes() + ", " + Helper.getMemInfo()); }
@Override public LocationIndex prepareIndex() { if (initialized) throw new IllegalStateException("Call prepareIndex only once"); StopWatch sw = new StopWatch().start(); prepareAlgo(); // in-memory preparation InMemConstructionIndex inMem = getPrepareInMemIndex(); // compact & store to dataAccess dataAccess.create(64 * 1024); try { inMem.store(inMem.root, START_POINTER); flush(); } catch (Exception ex) { throw new IllegalStateException("Problem while storing location index. " + Helper.getMemInfo(), ex); } float entriesPerLeaf = (float) inMem.size / inMem.leafs; initialized = true; logger.info("location index created in " + sw.stop().getSeconds() + "s, size:" + Helper.nf(inMem.size) + ", leafs:" + Helper.nf(inMem.leafs) + ", precision:" + minResolutionInMeter + ", depth:" + entries.length + ", checksum:" + calcChecksum() + ", entries:" + Arrays.toString(entries) + ", entriesPerLeaf:" + entriesPerLeaf); return this; }
/** * Fill quadtree which will span a raster over the entire specified graph g. But do this in a * pre-defined resolution which is controlled via capacity. This data structure then uses approx. * capacity * 4 bytes. So maximum capacity is 2^30 where the quadtree would cover the world * boundaries every 1.3km - IMO enough for EU or US networks. */ @Override public LocationIndex prepareIndex() { initBuffer(); initAlgo(latSize, lonSize); StopWatch sw = new StopWatch().start(); GHBitSet filledIndices = fillQuadtree(latSize * lonSize); int fillQT = filledIndices.getCardinality(); float res1 = sw.stop().getSeconds(); sw = new StopWatch().start(); int counter = fillEmptyIndices(filledIndices); float fillEmpty = sw.stop().getSeconds(); logger.info("filled quadtree index array in " + res1 + "s. size is " + getCapacity() + " (" + fillQT + "). filled empty " + counter + " in " + fillEmpty + "s"); flush(); return this; }
logger.info("found path in " + sw.getSeconds() + "s with nodes:" + path.calcNodes().size() + ", millis: " + path.getTime() + ", visited nodes:" + algo.getVisitedNodes());
protected PathWrapper doInBackground(Void... v) { StopWatch sw = new StopWatch().start(); GHRequest req = new GHRequest(fromLat, fromLon, toLat, toLon). setAlgorithm(Algorithms.DIJKSTRA_BI); req.getHints(). put(Routing.INSTRUCTIONS, "false"); GHResponse resp = hopper.route(req); time = sw.stop().getSeconds(); return resp.getBest(); }
String debug = ", algoInit:" + sw.stop().getSeconds() + "s"; debug += ", " + algo.getName() + "-routing:" + sw.stop().getSeconds() + "s"; if (tmpPathList.isEmpty()) throw new IllegalStateException("At least one path has to be returned for " + fromQResult + " -> " + toQResult);
@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)); }
float perRun = sw.stop().getSeconds() / ((float) (N - noJvmWarming)); System.out.println("# " + getClass().getSimpleName() + " " + entry + ":" + sw.stop().getSeconds() + ", per run:" + perRun); assertTrue("speed too low!? " + perRun + " per run", perRun < 0.08);
StopWatch sw = new StopWatch().start(); List<QueryResult> qResults = routingTemplate.lookup(points, encoder); ghRsp.addDebugInfo("idLookup:" + sw.stop().getSeconds() + "s"); if (ghRsp.hasErrors()) return Collections.emptyList();
@Override public void doSpecificWork() { StopWatch sw = new StopWatch().start(); LOGGER.info("Start calculating " + lms.getLandmarkCount() + " landmarks, default active lms:" + defaultActiveLandmarks + ", weighting:" + lms.getLmSelectionWeighting() + ", " + Helper.getMemInfo()); lms.createLandmarks(); lms.flush(); LOGGER.info("Calculated landmarks for " + (lms.getSubnetworksWithLandmarks() - 1) + " subnetworks, took:" + sw.stop().getSeconds() + " => " + lms.getLandmarksAsGeoJSON() + ", stored weights:" + lms.getLandmarkCount() + ", nodes:" + graph.getNodes() + ", " + Helper.getMemInfo()); }