Best method to measure execution time in Android?

What about TimingLogger?

From TimingLogger documentation:

TimingLogger timings = new TimingLogger(YOUR_TAG, "methodA");
// ... do some work A ... 
timings.addSplit("work A");
// ... do some work B ... 
timings.addSplit("work B");
// ... do some work C ... 
timings.addSplit("work C");
timings.dumpToLog();

and the dump will look like:

     D/TAG     (3459): methodA: begin
     D/TAG     (3459): methodA:      9 ms, work A
     D/TAG     (3459): methodA:      1 ms, work B
     D/TAG     (3459): methodA:      6 ms, work C
     D/TAG     (3459): methodA: end, 16 ms

Do not forget to enable your tag by running: adb shell setprop log.tag.YOUR_TAG VERBOSE

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)