How to test function for execution timing in android?

12.1k views Asked by At

I have got stucked where one of my function is taking some time to execute. I have a hierarchy of objects in object using object models and ArrayList(s). I just want to know the techniques by which I can debug the code to check which statement of code is taking time in execution.

2

There are 2 answers

1
mithrop On BEST ANSWER

Two solutions :

1
Remees M Syde On

Simply use this.

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

long MethodeDuration = (endTime - startTime);