如何在android中测试执行时序的功能?

Aas*_*rma 5 testing performance android performance-testing execution-time

我被困在我的一个功能需要一些时间来执行的地方.我使用对象模型和ArrayList(s)在对象中有一个对象层次结构.我只想知道调试代码的技术,以检查代码的哪个语句在执行时花费时间.

Rem*_*yde 11

只需使用它.

long startTime = System.nanoTime();
YourMethode();
long endTime = System.nanoTime();

long MethodeDuration = (endTime - startTime);
Run Code Online (Sandbox Code Playgroud)


mit*_*rop 4

两种解决方案: