What is the easiest to time execution in Android?
I have looked around a bit and I found TimingLogger on the Android SDK,
and instructions here. It looks very convenient.
But I can’t get it work. This is my code:
TimingLogger timings = new TimingLogger("TopicLogTag", "Parsing html");
My code to time here...
timings.dumpToLog();
It’s supposed to dump the times in LogCat. But I can’t see anything.. I What am I doing wrong? Eclipse doesn’t show any varnings. I guess it has something with verbose ouput, but I have set LogCat to show Verbose.
Thank you..
I gave it a test run and I am experiencing the same thing. It all boils down to this little bit of the description in the Javadoc for TimingLogger:
I did a test locally:
And oddly, I get an output to the log:
But that’s it. And since it’s false, I doubt TimingLogger is doing anything, based on the TimingLogger code:
I’m not sure why Log.isLoggable is returning false when it’s obviously logging at above VERBOSE, since my Log.d obviously logged.
You can enable logging for that tag manually from the [Log class Javadoc][3]:
Which I did through
adb shell:Results in:
See droidgren’s comment on this answer – apparently a call to addSplit is also necessary.
[3]: http://developer.android.com/reference/android/util/Log.html#isLoggable(java.lang.String, int)