long start=System.currentTimeMillis();
//....
//代码块执行....
//....
long end=System.currentTimeMillis()-start;
log.e(tag,"一共耗时"+end+"毫秒");
AS执行时间计算
该博客主要介绍了如何使用Java进行代码执行时间的测量,并将耗时信息通过日志输出。通过示例代码展示了longstart和longend变量的使用,用于计算代码块的运行时间,从而实现性能监控。

被折叠的 条评论
为什么被折叠?



