当前位置:网站首页>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
边栏推荐
- EditorUtility.SetDirty在Untiy中的作用以及应用
- Codeforces Round #804 (Div. 2)
- [mathematical modeling] differential equation -- sustainable development of fishing industry
- MySQL if and ifnull use
- 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
- 2021 robocom world robot developer competition - undergraduate group (semi-finals)
- Collection + interview questions
- Biscuits (examination version)
- Please wait while Jenkins is getting ready to work
- yolov5 tensorrt加速
猜你喜欢
[lgr-109] Luogu may race II & windy round 6
Fuzzy -- basic application method of AFL
Postman关联
几种RS485隔离通讯的方案介绍
IPv6 comprehensive experiment
Weng Kai C language third week 3.1 punch in
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
你需要知道的 TCP 三次握手
nacos-高可用seata之TC搭建(02)
用StopWatch 统计代码耗时
随机推荐
Supreme Court, judgment standard of divorce cases
Nacos TC setup of highly available Seata (02)
[lgr-109] Luogu may race II & windy round 6
图论的扩展
Rce code and Command Execution Vulnerability
Set detailed map + interview questions
Redis has four methods for checking big keys, which are necessary for optimization
idea一键导包
麦斯克电子IPO被终止:曾拟募资8亿 河南资产是股东
Simple understanding of interpreters and compilers
Hometown 20 years later (primary school exercises)
RT thread analysis - object container implementation and function
nacos-高可用seata之TC搭建(02)
集合详解之 Collection + 面试题
Realize a binary read-write address book
Fuzzy -- basic application method of AFL
比尔·盖茨晒18岁个人简历,48年前期望年薪1.2万美元
Codeforces Round #804 (Div. 2)
你需要知道的 TCP 三次握手
集合详解之 Map + 面试题