// 开启打印对象 TimeInterval timeInterval = new TimeInterval();
// 开始时间 timeInterval.start("checkOperation");
// 代码块
// 结束时间 log.info("执行时长:{}毫秒", timeInterval.intervalMs("checkOperation"));
注意:名字要一致,如:checkOperation
//方法二。2种方法的结果不一致???
StopWatch stopWatch = new StopWatch(); // 开始时间 stopWatch.start(); // 代码 TdCoursePageVO simpleCourseInfo = this.getSimpleCourseInfo(courseId); // 结束时间 stopWatch.stop(); System.out.printf("执行时长:%d 毫秒.%n", stopWatch.getTotalTimeMillis());