当前位置:网站首页>Using stopwatch to count code time
Using stopwatch to count code time
2022-07-06 05:10:00 【CBeann】
Total statistical output time
StopWatch sw = new StopWatch();
sw.start();
// long task simulation
try {
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
sw.stop();
System.out.println(sw.getTotalTimeMillis());

Print out the time-consuming and proportion of all tasks in an elegant format
StopWatch sw = new StopWatch();
sw.start("A");
Thread.sleep(500);
sw.stop();
sw.start("B");
Thread.sleep(300);
sw.stop();
sw.start("C");
Thread.sleep(200);
sw.stop();
System.out.println(sw.prettyPrint());

Reference resources
https://mp.weixin.qq.com/s/RNsuFaONmruEnyJGKad5sA
边栏推荐
猜你喜欢

Postman管理测试用例

GAMES202-WebGL中shader的编译和连接(了解向)

Orm-f & Q object

Acwing week 58

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

Nacos - TC Construction of High available seata (02)
![[effective Objective-C] - memory management](/img/1e/611aa998486bbac76ac103c3091794.jpg)
[effective Objective-C] - memory management

Easy to understand I2C protocol

麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東

RTP gb28181 document testing tool
随机推荐
Three methods of Oracle two table Association update
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
What should the project manager do if there is something wrong with team collaboration?
从0到1建设智能灰度数据体系:以vivo游戏中心为例
The kernel determines whether peripherals are attached to the I2C address
Hometown 20 years later (primary school exercises)
Excellent PM must experience these three levels of transformation!
Basic knowledge and examples of binary tree
Flody的应用
内核判断i2c地址上是否挂载外设
2021 RoboCom 世界机器人开发者大赛-本科组(复赛)
Extension of graph theory
Can the feelings of Xi'an version of "Coca Cola" and Bingfeng beverage rush for IPO continue?
【LGR-109】洛谷 5 月月赛 II & Windy Round 6
关于Unity Inspector上的一些常用技巧,一般用于编辑器扩展或者其他
集合详解之 Collection + 面试题
Realize a binary read-write address book
Driver development - hellowdm driver
Fuzzy -- basic application method of AFL
yolov5 tensorrt加速