List of usage examples for org.springframework.util StopWatch stop
public void stop() throws IllegalStateException
From source file:com.project.atm.core.App.java
static void loadDistanceMatrix() throws FileNotFoundException { //change the path file to correct location ! scDistance = new Scanner(new FileReader("/home/andry/Documents/atm/atmDistance.txt")); // load data from file int i = 1;/*from w w w . j a v a 2 s.c om*/ int j = 1; int total = locationList.size(); distance = new double[total][total]; logger.info("loading distance matrix tab file................."); StopWatch stopWatch = new StopWatch("Travel distance calculation"); stopWatch.start("load distance matrix file"); // convert matrix data to array while (scDistance.hasNextLine()) { //logger.info("i => "+ i +", j => "+j); distance[i - 1][j - 1] = scDistance.nextDouble(); if ((j % total) == 0) { i++; j = 0; if (i == total + 1) break; } j++; } stopWatch.stop(); logger.info(stopWatch.prettyPrint()); logger.info(stopWatch.prettyPrint()); }
From source file:com.project.atm.core.App.java
private static void generateGraphData() { StopWatch stopWatch = new StopWatch("Generate Graph from data"); stopWatch.start("run the shortest path algorithm"); // generate graph graph = new SimpleWeightedGraph<String, DefaultWeightedEdge>(DefaultWeightedEdge.class); // create vertex for (int c = 0; c < distance.length; c++) { graph.addVertex(getLocationById(c).getName()); }/*w w w. ja v a2s. co m*/ // set weight for (int x = 0; x < distance.length; x++) { for (int y = 0; y < distance.length; y++) { if (x != y) { if (getLocationById(x) != null && getLocationById(y) != null) { DefaultWeightedEdge e = graph.addEdge(getLocationById(x).getName(), getLocationById(y).getName()); if (e != null) graph.setEdgeWeight(e, distance[x][y]); } } } } stopWatch.stop(); logger.info(stopWatch.prettyPrint()); }
From source file:de.codecentric.batch.metrics.AbstractBatchMetricsAspect.java
private long getTotalTimeMillis(StopWatch stopWatch) { stopWatch.stop(); long duration = stopWatch.getTotalTimeMillis(); return duration; }
From source file:org.sventon.advice.StopWatchAroundAdvice.java
@Override public Object invoke(final MethodInvocation method) throws Throwable { final StopWatch stopWatch = new StopWatch(); stopWatch.start();// ww w.j a v a 2 s .c om final Object val = method.proceed(); stopWatch.stop(); logger.debug(createMessage(method.getMethod().getName(), stopWatch.getTotalTimeMillis())); return val; }
From source file:com.priitlaht.ppwebtv.common.config.apidoc.SwaggerConfiguration.java
@Bean public Docket swaggerSpringfoxDocket(ApplicationProperties applicationProperties) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start();//from w w w.j av a 2 s . c om Docket docket = getDocket(applicationProperties); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return docket; }
From source file:io.github.jhipster.config.liquibase.AsyncSpringLiquibase.java
protected void initDb() throws LiquibaseException { StopWatch watch = new StopWatch(); watch.start();/*from w w w . ja va 2 s . c o m*/ super.afterPropertiesSet(); watch.stop(); logger.debug("Liquibase has updated your database in {} ms", watch.getTotalTimeMillis()); if (watch.getTotalTimeMillis() > 5_000) { logger.warn("Warning, Liquibase took more than 5 seconds to start up!"); } }
From source file:org.zalando.zmon.actuator.ZmonRestResponseBackendMetricsInterceptor.java
@Override public ClientHttpResponse intercept(final HttpRequest request, final byte[] body, final ClientHttpRequestExecution execution) throws IOException { StopWatch stopwatch = new StopWatch(); stopwatch.start();//www .j av a 2 s. c o m ClientHttpResponse response = execution.execute(request, body); stopwatch.stop(); metricsWrapper.recordBackendRoundTripMetrics(request, response, stopwatch); return response; }
From source file:de.accso.performancetesting.tools.PerformanceLogger.java
private Object measureTime(ProceedingJoinPoint thisJoinPoint, String tag) throws Throwable { StopWatch sp = new StopWatch(); sp.start();//w w w . j av a2s . c om Object result = thisJoinPoint.proceed(); sp.stop(); logger.info(append("durationinmillis", sp.getTotalTimeMillis()).and(append("tag", tag)) .and(append("req_id", CTX_HOLDER.get().reqId)).and(append("url", getCtxUrl())) .and(append("servicename", thisJoinPoint.getTarget().getClass().getCanonicalName() + "." + thisJoinPoint.getSignature().getName())), "Performance"); return result; }
From source file:fi.helsinki.opintoni.integration.interceptor.LoggingInterceptor.java
@Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { StopWatch stopWatch = new StopWatch(); stopWatch.start();/* w w w . j a v a 2s . c o m*/ ClientHttpResponse response = execution.execute(request, body); stopWatch.stop(); log.info("Response for {} took {} seconds", request.getURI(), stopWatch.getTotalTimeSeconds()); return response; }
From source file:net.sf.gazpachoquest.aspects.ProfilingAdvise.java
public Object doProfiling(final ProceedingJoinPoint proceedingJoinPoint) throws Throwable { String taskName = createTaskName(proceedingJoinPoint); StopWatch taskTimer = new StopWatch(); try {/*w w w . j a va 2 s . c o m*/ taskTimer.start(taskName); return proceedingJoinPoint.proceed(); } finally { taskTimer.stop(); doLogging(taskTimer.getLastTaskInfo()); } }