Ever came across an application taking too much time to launch, animate, stutter, download etc. Just came across this simple logging support by Looper to isolate the problem. Traceview does helps a lot when dealing with an unknown code base but with well known application code, the messages sent to the main thread often rings a bell. All that is needed is to find the message which consumes more cycles.
Looper.getMainLooper().setMessageLogging(new Printer() {
@Override
public void println(String x) {
Log.d(TAG, "Looped [" + x + "]");
}
});
...
...
...
}
Beware of the spam logs, if only there was an overloaded API to log only messages handled in so much of time.
public void onCreate() {
Looper.getMainLooper().setMessageLogging(new Printer() {
@Override
public void println(String x) {
Log.d(TAG, "Looped [" + x + "]");
}
});
...
...
...
}
Beware of the spam logs, if only there was an overloaded API to log only messages handled in so much of time.
No comments:
Post a Comment