import cn.hutool.core.date.StopWatch;
import java.util.concurrent.TimeUnit;
public class PsvmTest {
public static void main(String[] args) throws InterruptedException {
StopWatch stopWatch = new StopWatch();
stopWatch.start("method name");
Thread.sleep(1000L);
stopWatch.stop();
String s = stopWatch.prettyPrint(TimeUnit.MILLISECONDS);
System.out.println(s);
}
}
StopWatch '': running time = 1000 ms
---------------------------------------------
ms % Task name
---------------------------------------------
000001000 100%
Process finished with exit code 0