public class StopWatch extends Object
Modifier and Type | Class and Description |
---|---|
class |
StopWatch.StopTag
TAG
|
Modifier and Type | Method and Description |
---|---|
static StopWatch |
begin()
计时器开始计时
|
static StopWatch |
begin(boolean nano)
计时器开始计时
|
static StopWatch |
create()
创建一个计时器
|
static StopWatch |
create(boolean nano)
创建一个计时器
|
long |
getDuration() |
long |
getEndTime()
停止计时的时间
|
long |
getStartTime()
开始计时的时间
|
boolean |
isNano()
是否纳秒计算
|
static StopWatch |
run(Runnable r)
计时运行
|
static StopWatch |
run(Runnable r,
boolean nano)
计时运行
|
long |
start()
开始计时
|
long |
stop()
停止记时
|
StopWatch.StopTag |
tag() |
StopWatch.StopTag |
tag(String name) |
StopWatch.StopTag |
tag(String tpl,
Object... args)
记录, 模板字符串命名
|
String |
toString() |
public static StopWatch begin()
public static StopWatch begin(boolean nano)
nano
- 是否精确到纳秒public static StopWatch create()
public static StopWatch create(boolean nano)
nano
- 是否精确到纳秒public static StopWatch run(Runnable r, boolean nano)
r
- runnablepublic long start()
public long stop()
public long getDuration()
public boolean isNano()
public long getStartTime()
public long getEndTime()
public StopWatch.StopTag tag()
public StopWatch.StopTag tag(String name)
name
- 记录名称public StopWatch.StopTag tag(String tpl, Object... args)
tpl
- 模板args
- 参数Copyright © 2024. All rights reserved.