这两天在弄Android Trace。在程序中也用Calendar.getInstance().getTime()来获取函数执行时间。
结果在Trace中函数执行的时间比用Calendar.getInstance().getTime()短。不知道什么原因,特来请教高手。具体情况是这样:程序中获取时间方法:
Date start = Calendar.getInstance().getTime();
//function
Date end = Calendar.getInstance().getTime();
log("TRACE Use time is : " + Long.toString(end.getTime() - start.getTime()));Trace中是用Traceview.bat查看的TRACE文件。结果发现时间不一致。
在查看Traceview文档时,有这么一句:
在介绍Key File Format时:
version section 
The first line is the file version number, currently 1. The second line, clock=global, indicates that we use a common clock across all threads. A future version may use per-thread CPU time counters that are independent for every thread. 然后我查看了下Trace文件中,里面显示是这样的:clock=thread-cpu,不太清楚这个代表的什么意思?是CPU时间吗?如果是CPU时间的话,还可以解释一下。有了解的同志吗?帮忙给解答一下,多谢!