| 程序包 | 说明 |
|---|---|
| com.github.jarvisframework.tool.core.date |
| 限定符和类型 | 方法和说明 |
|---|---|
static StopWatch |
DateUtils.createStopWatch()
创建秒表
StopWatch,用于对代码块的执行时间计数
使用方法如下:
StopWatch stopWatch = DateUtils.createStopWatch();
// 任务1
stopWatch.start("任务一");
Thread.sleep(1000);
stopWatch.stop();
// 任务2
stopWatch.start("任务一");
Thread.sleep(2000);
stopWatch.stop();
// 打印出耗时
Console.log(stopWatch.prettyPrint());
|
static StopWatch |
DateUtils.createStopWatch(String id)
创建秒表
StopWatch,用于对代码块的执行时间计数
使用方法如下:
StopWatch stopWatch = DateUtils.createStopWatch("任务名称");
// 任务1
stopWatch.start("任务一");
Thread.sleep(1000);
stopWatch.stop();
// 任务2
stopWatch.start("任务一");
Thread.sleep(2000);
stopWatch.stop();
// 打印出耗时
Console.log(stopWatch.prettyPrint());
|
Copyright © 2020. All rights reserved.