List of usage examples for org.springframework.util StopWatch getTotalTimeMillis
public long getTotalTimeMillis()
From source file:com.home.ln_spring.ch4.mi.MethodReplacementExample.java
private static void displayInfo(ReplacementTarget target) { System.out.println(target.formatMessage("Hello World!")); StopWatch stopWatch = new StopWatch(); stopWatch.start("perfTest"); for (int x = 0; x < 1000000; x++) { String out = target.formatMessage("foo"); }/*from w ww .j av a2 s . c o m*/ stopWatch.stop(); System.out.println("1000000 invocations took: " + stopWatch.getTotalTimeMillis() + " ms."); }
From source file:camel.Main.java
private static void testBatchOfMessages(final ProducerTemplate template, int number, int batch) throws Exception { StopWatch stopWatch = new StopWatch(); stopWatch.start();//from w ww . jav a2s .co m for (int i = 0; i < number; i++) { template.requestBody(String.valueOf(i)); } stopWatch.stop(); System.out.println(batch + ". Exchanged " + number + " messages in " + stopWatch.getTotalTimeMillis()); }
From source file:com.home.ln_spring.ch4.mi.lookupDemo.java
public static void displayInfo(DemoBean bean) { MyHelper helper1 = bean.getMyHelper(); MyHelper helper2 = bean.getMyHelper(); System.out.println("Helper Instances the Same?: " + (helper1 == helper2)); StopWatch stopWatch = new StopWatch(); stopWatch.start("lookupDemo"); for (int x = 0; x < 100000; x++) { MyHelper helper = bean.getMyHelper(); helper.doSomethingHelpful();/*from ww w . j a v a 2s . c o m*/ } stopWatch.stop(); System.out.println("100000 gets took " + stopWatch.getTotalTimeMillis() + " ms"); }
From source file:de.codecentric.batch.metrics.AbstractBatchMetricsAspect.java
private long getTotalTimeMillis(StopWatch stopWatch) { stopWatch.stop();//ww w . j a va2 s .c om long duration = stopWatch.getTotalTimeMillis(); return duration; }
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 www . ja v a 2s.c o m Docket docket = getDocket(applicationProperties); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return docket; }
From source file:org.sventon.advice.StopWatchAroundAdvice.java
@Override public Object invoke(final MethodInvocation method) throws Throwable { final StopWatch stopWatch = new StopWatch(); stopWatch.start();/* www . j a v a 2 s. com*/ final Object val = method.proceed(); stopWatch.stop(); logger.debug(createMessage(method.getMethod().getName(), stopWatch.getTotalTimeMillis())); return val; }
From source file:de.accso.performancetesting.tools.PerformanceLogger.java
private Object measureTime(ProceedingJoinPoint thisJoinPoint, String tag) throws Throwable { StopWatch sp = new StopWatch(); sp.start();//from w w w . ja v a 2s . co m 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:com.cedarsoft.history.core.GlazedPerformanceTest.java
@Test public void testTiming() { for (int i = 0; i < 5; i++) { checkPerformance(new ArrayList<String>()); checkPerformance(GlazedLists.<String>eventList(new ArrayList<String>())); }/* w w w . j av a2 s . c om*/ StopWatch watch0 = checkPerformance(new ArrayList<String>()); System.out.println(watch0.prettyPrint()); StopWatch watch1 = checkPerformance(GlazedLists.<String>eventList(new ArrayList<String>())); System.out.println(watch1.prettyPrint()); System.out.println("Delta: " + (watch1.getTotalTimeMillis() - watch0.getTotalTimeMillis())); }
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 . j a v a 2 s.c om*/ 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:com.agileapes.webexport.concurrent.Worker.java
@SuppressWarnings("unchecked") @Override/* ww w . j a va2s. co m*/ public void run() { synchronized (this) { while (true) { try { logger.info("Waiting for a task."); wait(); } catch (InterruptedException e) { logger.warn(getName() + " was interrupted."); manager.interrupted(this); return; } try { final StopWatch watch = new StopWatch(); watch.start(); perform(); watch.stop(); logger.info("Action performed in " + watch.getTotalTimeMillis() + "ms"); } catch (Throwable e) { logger.error(e); manager.fail(this); } logger.info(getName() + " is done."); manager.done(this); } } }