List of usage examples for org.springframework.util StopWatch StopWatch
public StopWatch()
From source file:com.cedarsoft.history.core.GlazedPerformanceTest.java
private static StopWatch checkPerformance(@Nonnull List<String> list) { StopWatch stopWatch = new StopWatch(); stopWatch.start("adding to " + list.getClass().getName()); for (int i = 0; i < 100000; i++) { list.add(String.valueOf(i)); }/*from ww w . j a v a 2 s . c om*/ stopWatch.stop(); stopWatch.start("iterating through " + list.getClass().getName()); for (String currentEntry : list) { assertNotNull(currentEntry); } stopWatch.stop(); assertNotNull(stopWatch); return stopWatch; }
From source file:com.vedri.mtp.frontend.support.apidoc.SwaggerConfiguration.java
/** * Swagger Springfox configuration.//from w w w . j a v a2 s . c o m */ @Bean public Docket swaggerSpringfoxDocket(FrontendProperties frontendProperties) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start(); ApiInfo apiInfo = new ApiInfo(frontendProperties.getSwagger().getTitle(), frontendProperties.getSwagger().getDescription(), frontendProperties.getSwagger().getVersion(), frontendProperties.getSwagger().getTermsOfServiceUrl(), frontendProperties.getSwagger().getContact(), frontendProperties.getSwagger().getLicense(), frontendProperties.getSwagger().getLicenseUrl()); Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo) .genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true) .genericModelSubstitutes(ResponseEntity.class) .directModelSubstitute(java.time.LocalDate.class, String.class) .directModelSubstitute(java.time.ZonedDateTime.class, Date.class) .directModelSubstitute(java.time.LocalDateTime.class, Date.class).select() .paths(regex(DEFAULT_INCLUDE_PATTERN)).build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return docket; }
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();//from w w w .j av a 2 s . c om ClientHttpResponse response = execution.execute(request, body); stopwatch.stop(); metricsWrapper.recordBackendRoundTripMetrics(request, response, stopwatch); return response; }
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 ww . j a v a 2s . co m*/ ClientHttpResponse response = execution.execute(request, body); stopWatch.stop(); log.info("Response for {} took {} seconds", request.getURI(), stopWatch.getTotalTimeSeconds()); return response; }
From source file:ar.com.estigiait.app.config.apidoc.SwaggerConfiguration.java
/** * Swagger Springfox configuration.//from ww w . ja va 2s . c om */ @Bean @Profile("!" + Constants.SPRING_PROFILE_FAST) public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start(); ApiInfo apiInfo = new ApiInfo(jHipsterProperties.getSwagger().getTitle(), jHipsterProperties.getSwagger().getDescription(), jHipsterProperties.getSwagger().getVersion(), jHipsterProperties.getSwagger().getTermsOfServiceUrl(), jHipsterProperties.getSwagger().getContact(), jHipsterProperties.getSwagger().getLicense(), jHipsterProperties.getSwagger().getLicenseUrl()); Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo) .genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true) .genericModelSubstitutes(ResponseEntity.class).ignoredParameterTypes(Pageable.class) .directModelSubstitute(java.time.LocalDate.class, String.class) .directModelSubstitute(java.time.ZonedDateTime.class, Date.class) .directModelSubstitute(java.time.LocalDateTime.class, Date.class).select() .paths(regex(DEFAULT_INCLUDE_PATTERN)).build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return docket; }
From source file:com.bucketlist.config.apidoc.SwaggerConfiguration.java
/** * Swagger Springfox configuration.//from w w w . j av a 2 s . c o m */ @Bean public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start(); ApiInfo apiInfo = new ApiInfo(jHipsterProperties.getSwagger().getTitle(), jHipsterProperties.getSwagger().getDescription(), jHipsterProperties.getSwagger().getVersion(), jHipsterProperties.getSwagger().getTermsOfServiceUrl(), jHipsterProperties.getSwagger().getContact(), jHipsterProperties.getSwagger().getLicense(), jHipsterProperties.getSwagger().getLicenseUrl()); Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo) .genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true) .genericModelSubstitutes(ResponseEntity.class) .directModelSubstitute(java.time.LocalDate.class, String.class) .directModelSubstitute(java.time.ZonedDateTime.class, Date.class) .directModelSubstitute(java.time.LocalDateTime.class, Date.class).select() .paths(regex(DEFAULT_INCLUDE_PATTERN)).build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return docket; }
From source file:com.jeanmile.config.apidoc.SwaggerConfiguration.java
/** * Swagger Springfox configuration.//from w w w . j a v a 2 s . c om */ @Bean public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start(); ApiInfo apiInfo = new ApiInfo(jHipsterProperties.getSwagger().getTitle(), jHipsterProperties.getSwagger().getDescription(), jHipsterProperties.getSwagger().getVersion(), jHipsterProperties.getSwagger().getTermsOfServiceUrl(), jHipsterProperties.getSwagger().getContact(), jHipsterProperties.getSwagger().getLicense(), jHipsterProperties.getSwagger().getLicenseUrl()); Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo) .genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true) .genericModelSubstitutes(ResponseEntity.class) .directModelSubstitute(org.joda.time.LocalDate.class, String.class) .directModelSubstitute(org.joda.time.LocalDateTime.class, Date.class) .directModelSubstitute(org.joda.time.DateTime.class, Date.class) .directModelSubstitute(java.time.LocalDate.class, String.class) .directModelSubstitute(java.time.ZonedDateTime.class, Date.class) .directModelSubstitute(java.time.LocalDateTime.class, Date.class).select() .paths(regex(DEFAULT_INCLUDE_PATTERN)).build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return docket; }
From source file:org.jsmiparser.SpringTest.java
@Test public void testPperformance() { int times = 10000000; StopWatch stopWatch = new StopWatch(); stopWatch.start("query for " + times + " times"); for (int i = 0; i < times; i++) { getMib().getOidValues().find("snmpOutPkts"); }// www. ja va2 s . c o m stopWatch.stop(); System.out.println(stopWatch.prettyPrint()); }
From source file:org.nebulaframework.util.profiling.ProfilingAspect.java
/** * Advice of Profiling Aspect. Measures and logs the exection * time of advised method.//from ww w. ja v a 2 s . c o m * * @param pjp {ProceedingJoinPoint} * @return Object result * @throws Throwable if exception occurs */ @Around("profilingPointcut()") public Object profile(ProceedingJoinPoint pjp) throws Throwable { StopWatch sw = new StopWatch(); Log localLog = null; try { // Get Log localLog = LogFactory.getLog(pjp.getTarget().getClass()); // Start StopWatch sw.start(); // Proceed Invocation return pjp.proceed(); } finally { // Stop StopWatch sw.stop(); if (localLog == null) { // If local Log not found, use ProfilingAspect's Log localLog = log; } //Log Stats localLog.debug("[Profiling] " + pjp.getTarget().getClass().getName() + "->" + pjp.getSignature().getName() + "() | " + sw.getLastTaskTimeMillis() + " ms"); } }
From source file:net.biocloud.bioservice.config.apidoc.SwaggerConfiguration.java
/** * Swagger Springfox configuration.// w w w . j a v a2 s. c o m */ @Bean public Docket swaggerSpringfoxDocket(BioserviceProperties bioserviceProperties) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start(); ApiInfo apiInfo = new ApiInfo(bioserviceProperties.getSwagger().getTitle(), bioserviceProperties.getSwagger().getDescription(), bioserviceProperties.getSwagger().getVersion(), bioserviceProperties.getSwagger().getTermsOfServiceUrl(), bioserviceProperties.getSwagger().getContact(), bioserviceProperties.getSwagger().getLicense(), bioserviceProperties.getSwagger().getLicenseUrl()); Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo) .genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true) .genericModelSubstitutes(ResponseEntity.class).ignoredParameterTypes(Pageable.class) .directModelSubstitute(java.time.LocalDate.class, String.class) .directModelSubstitute(java.time.ZonedDateTime.class, Date.class) .directModelSubstitute(java.time.LocalDateTime.class, Date.class).select() .paths(regex(DEFAULT_INCLUDE_PATTERN)).build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return docket; }