List of usage examples for org.springframework.util StopWatch getTotalTimeMillis
public long getTotalTimeMillis()
From source file:org.zalando.zmon.actuator.metrics.MetricsWrapper.java
public void recordBackendRoundTripMetrics(final HttpRequest request, final ClientHttpResponse response, final StopWatch stopwatch) { try {/*from w ww . ja va 2 s . c o m*/ recordBackendRoundTripMetrics(request.getMethod().name(), getHost(request), response.getRawStatusCode(), stopwatch.getTotalTimeMillis()); } catch (IOException e) { logger.warn("Could not detect status for " + response); } }
From source file:com.swarmcn.user.web.config.SwaggerConfiguration.java
@Bean public Docket swaggerSpringfoxDocket() { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start();/*from w w w . j ava 2s .c o m*/ Docket swaggerSpringMvcPlugin = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()) .genericModelSubstitutes(ResponseEntity.class).select().build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return swaggerSpringMvcPlugin; }
From source file:profiling.ProfilingInterceptor.java
@Override public Object invoke(MethodInvocation mi) throws Throwable { StopWatch sw = new StopWatch(); sw.start(mi.getMethod().getName());//from ww w .j a v a 2 s.c o m String methodName = mi.getMethod().getName(); if ("sayNigga".equals(methodName)) { System.out.println("FUCK YOU NIGGA!"); return null; } Object returnValue = mi.proceed(); sw.stop(); dumpInfo(mi, sw.getTotalTimeMillis()); return returnValue; }
From source file:cn.edu.cqu.jwc.mis.ta.util.CallMonitoringAspect.java
@Around("within(@org.springframework.stereotype.Repository *)") public Object invoke(ProceedingJoinPoint joinPoint) throws Throwable { if (this.enabled) { StopWatch sw = new StopWatch(joinPoint.toShortString()); sw.start("invoke"); try {/*from w ww .ja va 2s. c o m*/ return joinPoint.proceed(); } finally { sw.stop(); synchronized (this) { this.callCount++; this.accumulatedCallTime += sw.getTotalTimeMillis(); } } } else { return joinPoint.proceed(); } }
From source file:org.ansoya.drugs.configuration.SwaggerConfiguration.java
@Bean public Docket swaggerSpringfoxDocket() { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start();/* w w w .j av a 2s. c o m*/ Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()) .genericModelSubstitutes(ResponseEntity.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)) // and by paths .build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return docket; /* ApiInfo apiInfo = new ApiInfo("sample of springboot", "sample of springboot", null, null, null, null, null); Docket docket = new Docket(DocumentationType.SWAGGER_2).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build() .apiInfo(apiInfo).useDefaultResponseMessages(false); return docket; */ }
From source file:ch.alv.sysinfos.config.apidoc.SwaggerConfiguration.java
/** * Swagger Spring MVC configuration./*w w w .java2 s . c o m*/ */ @Bean public SwaggerSpringMvcPlugin swaggerSpringMvcPlugin(SpringSwaggerConfig springSwaggerConfig) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start(); SwaggerSpringMvcPlugin swaggerSpringMvcPlugin = new SwaggerSpringMvcPlugin(springSwaggerConfig) .apiInfo(apiInfo()).genericModelSubstitutes(ResponseEntity.class) .includePatterns(DEFAULT_INCLUDE_PATTERN); swaggerSpringMvcPlugin.build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return swaggerSpringMvcPlugin; }
From source file:com.kb.config.apidoc.SwaggerConfiguration.java
/** * Swagger Spring MVC configuration.// w ww. j ava 2 s. c om */ @Bean public SwaggerSpringMvcPlugin swaggerSpringMvcPlugin(final SpringSwaggerConfig springSwaggerConfig) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start(); SwaggerSpringMvcPlugin swaggerSpringMvcPlugin = new SwaggerSpringMvcPlugin(springSwaggerConfig) .apiInfo(apiInfo()).genericModelSubstitutes(ResponseEntity.class) .includePatterns(DEFAULT_INCLUDE_PATTERN); swaggerSpringMvcPlugin.build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return swaggerSpringMvcPlugin; }
From source file:com.mediaiq.aggregator.configurations.SwaggerConfiguration.java
@Bean public Docket swaggerSpringfoxDocket() { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start();/*from w w w .j a v a 2 s .c om*/ Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()) .genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true) .ignoredParameterTypes(XMLGregorianCalendar.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.ZmonMetricsFilter.java
@Override protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws ServletException, IOException { StopWatch stopWatch = new StopWatch(); stopWatch.start();//from ww w . j av a 2s. c om String path = new UrlPathHelper().getPathWithinApplication(request); int status = HttpStatus.INTERNAL_SERVER_ERROR.value(); try { chain.doFilter(request, response); status = getStatus(response); } finally { stopWatch.stop(); metricsWrapper.recordClientRequestMetrics(request, path, status, stopWatch.getTotalTimeMillis()); } }
From source file:com.pubkit.SwaggerConfig.java
/** * Swagger Spring MVC configuration.//from www . j av a2 s. co m */ @Bean public SwaggerSpringMvcPlugin swaggerSpringMvcPlugin(SpringSwaggerConfig springSwaggerConfig) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start(); SwaggerSpringMvcPlugin swaggerSpringMvcPlugin = new SwaggerSpringMvcPlugin(springSwaggerConfig) .apiInfo(apiInfo()).directModelSubstitute(Date.class, String.class) .genericModelSubstitutes(ResponseEntity.class).includePatterns(DEFAULT_INCLUDE_PATTERN); swaggerSpringMvcPlugin.build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return swaggerSpringMvcPlugin; }