当前位置:网站首页>用StopWatch 统计代码耗时
用StopWatch 统计代码耗时
2022-07-06 05:01:00 【CBeann】
统计输出总耗时
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());
以优雅的格式打出所有任务的耗时以及占比
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());
参考
https://mp.weixin.qq.com/s/RNsuFaONmruEnyJGKad5sA
边栏推荐
- Oracle query table index, unique constraint, field
- On the solution of es8316's audio burst
- Review of double pointer problems
- Three. JS learning - light and shadow (understanding)
- Nestjs配置文件上传, 配置中间件以及管道的使用
- February 12 relativelayout
- Summary of three log knowledge points of MySQL
- Postman pre script - global variables and environment variables
- Weng Kai C language third week 3.1 punch in
- Simple understanding of interpreters and compilers
猜你喜欢
Flody的应用
[mathematical modeling] differential equation -- sustainable development of fishing industry
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
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
ORM aggregate query and native database operation
Yolov5 tensorrt acceleration
Lepton 无损压缩原理及性能分析
Postman Association
SQL injection vulnerability (MSSQL injection)
Three methods of Oracle two table Association update
随机推荐
Project manager, can you draw prototypes? Does the project manager need to do product design?
CUDA11.1在线安装
Quick sort
The underlying structure of five data types in redis
Fuzzy -- basic application method of AFL
Hyperledger Fabric2. Some basic concepts of X (1)
F12 solve the problem that web pages cannot be copied
nacos-高可用seata之TC搭建(02)
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
win10电脑系统里的视频不显示缩略图
Bill Gates posted his 18-year-old resume and expected an annual salary of $12000 48 years ago
IPv6 comprehensive experiment
Codeforces Round #804 (Div. 2)
[FreeRTOS interrupt experiment]
Lepton 无损压缩原理及性能分析
Postman前置脚本-全局变量和环境变量
Zynq learning notes (3) - partial reconfiguration
[NOIP2009 普及组] 分数线划定
Programmers' position in the Internet industry | daily anecdotes
Fuzzy -- basic application method of AFL