我的Android代码有几种方法,我在Android中使用AspectJ查找每个方法执行时间。为此我正在使用 -
pointcut methodCalls():
execution(* com.example.buttontestaspect..*(..))&& !within(com.example.buttontestaspect.testbutton);
before(): methodCalls(){
start = System.currentTimeMillis();//Start of execution time of method
Log.d("hi", "start = " + start);
}
after(): methodCalls(){
double end = System.currentTimeMillis();//End of execution time of method
Log.d("hi", "end = " + end);
double t = (end - start);
}
每当新方法执行开始时,我都会检查before()中的开始时间值。它始终是常量,等于1.445714916545E12。这是正确的还是我做错了什么?
答案 0 :(得分:0)
System.currentTimeMillis()返回一个long,但是你将它插入一个double。我会尝试将它改成很长时间,看看是否有诀窍。