當前位置: 首頁>>代碼示例>>Java>>正文


Java StopWatch.getTotalTimeMillis方法代碼示例

本文整理匯總了Java中org.springframework.util.StopWatch.getTotalTimeMillis方法的典型用法代碼示例。如果您正苦於以下問題:Java StopWatch.getTotalTimeMillis方法的具體用法?Java StopWatch.getTotalTimeMillis怎麽用?Java StopWatch.getTotalTimeMillis使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.util.StopWatch的用法示例。


在下文中一共展示了StopWatch.getTotalTimeMillis方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: responseEnd

import org.springframework.util.StopWatch; //導入方法依賴的package包/類
@Override
public void responseEnd(StopWatch requestWatch, HttpServerResponse response) {
    requestWatch.stop();
    counterService.increment("responses.count.total");
    int statusCode = response.getStatusCode();
    long totalTimeMillis = requestWatch.getTotalTimeMillis();
    gaugeService.submit("responses.totalTime.all", totalTimeMillis);
    if (statusCode > 400) {
        gaugeService.submit("responses.totalTime.error.all", totalTimeMillis);
        counterService.increment("responses.count.error.total");
        if (statusCode > 500) {
            counterService.increment("responses.count.error.server");
            gaugeService.submit("responses.totalTime.error.server", totalTimeMillis);
        } else {
            counterService.increment("responses.count.error.client");
            gaugeService.submit("responses.totalTime.error.client", totalTimeMillis);
        }
    } else if (statusCode > 300) {
        counterService.increment("responses.count.redirect");
        gaugeService.submit("responses.totalTime.redirect", totalTimeMillis);
    } else if (statusCode > 200) {
        counterService.increment("responses.count.success");
        gaugeService.submit("responses.totalTime.success", totalTimeMillis);
    }
}
 
開發者ID:unbroken-dome,項目名稱:vertx-spring,代碼行數:26,代碼來源:VertxActuatorMetrics.java

示例2: invoke

import org.springframework.util.StopWatch; //導入方法依賴的package包/類
@Around("@annotation(com.apssouza.monitoring.Monitored)")
public Object invoke(ProceedingJoinPoint joinPoint) throws Throwable {
    System.out.println("callend");
    Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
    if (this.enabled) {
        StopWatch sw = new StopWatch(joinPoint.toShortString());

        sw.start("invoke");
        try {
            return joinPoint.proceed();
        } finally {
            sw.stop();
            synchronized (this) {
                this.callCount++;
                this.accumulatedCallTime += sw.getTotalTimeMillis();
            }
            publisher.publishEvent(new MonitoringInvokedEvent(
                    method.getName(),
                    this.accumulatedCallTime
            ));
        }
    } else {
        return joinPoint.proceed();
    }
}
 
開發者ID:apssouza22,項目名稱:java-microservice,代碼行數:26,代碼來源:CallMonitoringAspect.java

示例3: invoke

import org.springframework.util.StopWatch; //導入方法依賴的package包/類
@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 {
            return joinPoint.proceed();
        } finally {
            sw.stop();
            synchronized (this) {
                this.callCount++;
                this.accumulatedCallTime += sw.getTotalTimeMillis();
            }
        }
    } else {
        return joinPoint.proceed();
    }
}
 
開發者ID:PacktPublishing,項目名稱:DevOps-for-Web-Development,代碼行數:20,代碼來源:CallMonitoringAspect.java

示例4: initDb

import org.springframework.util.StopWatch; //導入方法依賴的package包/類
protected void initDb() throws LiquibaseException {
    StopWatch watch = new StopWatch();
    watch.start();
    super.afterPropertiesSet();
    watch.stop();
    logger.debug(STARTED_MESSAGE, watch.getTotalTimeMillis());
    if (watch.getTotalTimeMillis() > SLOWNESS_THRESHOLD * 1000L) {
        logger.warn(SLOWNESS_MESSAGE, SLOWNESS_THRESHOLD);
    }
}
 
開發者ID:jhipster,項目名稱:jhipster,代碼行數:11,代碼來源:AsyncSpringLiquibase.java

示例5: createTimerString

import org.springframework.util.StopWatch; //導入方法依賴的package包/類
private String createTimerString(StopWatch stopWatch) {
    long millis = stopWatch.getTotalTimeMillis();
    return format(" [%d ms]", millis);
}
 
開發者ID:jakubnabrdalik,項目名稱:hentai,代碼行數:5,代碼來源:LoggingAspect.java

示例6: stopTiming

import org.springframework.util.StopWatch; //導入方法依賴的package包/類
static long stopTiming(StopWatch stopWatch) {
    if (stopWatch.isRunning()) {
        stopWatch.stop();
    }
    return stopWatch.getTotalTimeMillis();
}
 
開發者ID:ePages-de,項目名稱:spring-boot-readiness,代碼行數:7,代碼來源:Timer.java

示例7: assertStopWatchTimeLimit

import org.springframework.util.StopWatch; //導入方法依賴的package包/類
private static void assertStopWatchTimeLimit(final StopWatch sw, final long maxTimeMillis) {
	final long totalTimeMillis = sw.getTotalTimeMillis();
	assertTrue("'" + sw.getLastTaskName() + "' took too long: expected less than<" + maxTimeMillis
			+ "> ms, actual<" + totalTimeMillis + "> ms.", totalTimeMillis < maxTimeMillis);
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:6,代碼來源:AspectJAutoProxyCreatorTests.java


注:本文中的org.springframework.util.StopWatch.getTotalTimeMillis方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。