【问题标题】:Android Method execution time using AspectJ使用 AspectJ 的 Android 方法执行时间
【发布时间】:2015-10-24 19:39:24
【问题描述】:

我的 Android 代码有几种方法,我正在使用 AspectJ 在 Android 中查找每个方法的执行时间。为此,我正在使用 -

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。这是正确的还是我做错了什么?

【问题讨论】:

    标签: android aspectj


    【解决方案1】:

    System.currentTimeMillis() 返回一个 long,但您将它插入到 double 中。我会尝试将其更改为 long ,看看是否可以解决问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多