2015-10-24 71 views
2

我的Android代碼有幾種方法,我使用AspectJ在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); 
     } 

每當一個新的方法執行開始發生的事情,我之前檢查的開始時間()的值。它總是不變的,等於1.445714916545E12。這是正確的還是我做錯了什麼?

回答

0

System.currentTimeMillis()返回一個long,但是你將它插入到double中。我會嘗試改變它很長一段時間,看看這是否有竅門。

相關問題