【问题标题】:How to log the start time and the end time of each method in Android project?如何记录Android项目中每个方法的开始时间和结束时间?
【发布时间】:2013-12-10 07:35:03
【问题描述】:

我需要生成Android项目的Call Graph。有没有工具可以记录Android项目中每个方法的开始时间和结束时间?我尝试了traceview,它可以显示该方法需要多长时间,但我找不到开始时间和结束时间。

【问题讨论】:

    标签: android performance profiler


    【解决方案1】:
    long startedAt = System.currentTimeMillis();
    Log.d("ApplicationTag", "Started method X at time: " + startedAt);
    ...
    long finishedAt = System.currentTimeMillis();
    Log.d("ApplicationTag", "Finished method X at time: " + finishedAt + " after: " + (finishedAt-startedAt) + " milliseconds");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多