Skip to content

Instantly share code, notes, and snippets.

@DenBond7
Created February 8, 2019 15:39
Show Gist options
  • Save DenBond7/38e17d89d2626510cd3de93feed571b5 to your computer and use it in GitHub Desktop.
Save DenBond7/38e17d89d2626510cd3de93feed571b5 to your computer and use it in GitHub Desktop.
TimingLogger
// Before use it need run next command in terminal
// adb shell setprop log.tag.TAG VERBOSE
// Details here https://developer.android.com/reference/android/util/TimingLogger
TimingLogger timings = new TimingLogger(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();
//Result will look like this
//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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment