StopWatch用法

xiaoxiao2021-02-28  81

时间统计类,用来计算程序调用过程中花费了多久时间,它有start方法,stop方法,getTime统计的是start调用到stop调用间执行的耗时。

示例:

public static void main(String[] args) throws InterruptedException { StopWatch sw = new StopWatch(); sw.start(); Thread.sleep(1000); sw.stop(); System.out.println(Long.valueOf(sw.getTime())); }
转载请注明原文地址: https://www.6miu.com/read-65468.html

最新回复(0)