使用AspectJ的Android方法执行时间
我的Android代码有几个方法,我使用AspectJ在Android中查找每个方法的执行时间。为此,我正在使用-使用AspectJ的Android方法执行时间,android,aspectj,Android,Aspectj,我的Android代码有几个方法,我使用AspectJ在Android中查找每个方法的执行时间。为此,我正在使用- pointcut methodCalls(): execution(* com.example.buttontestaspect..*(..))&& !within(com.example.buttontestaspect.testbutton); before(): methodCalls(){ start = System.
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()中检查start time的值。它总是常数,等于1.445714916545E12。这是正确的还是我做错了什么?System.currentTimeMillis()返回一个long,但您正在将它插入一个double。我会试着把它改成长的,看看这是否奏效