Tracing

Once you identify what is taking too much time, you probably want to be able to know in more detail which methods are the culprits. You can do this by creating trace files with the help of a tracing-specific method, and then analyze them with the Traceview tool.

Debug.startMethodTracing()

Android provides the Debug.startMethodTracing() method to create trace files that can then be used with the Traceview tool to debug and profile your application. There are actually four variants of the Debug.startMethodTracing() method:

  • startMethodTracing()
  • startMethodTracing(String traceName)
  • startMethodTracing(String traceName, int bufferSize)
  • startMethodTracing(String traceName, int bufferSize, int flags)

The traceName parameter specifies the name ...

Get Pro Android Apps Performance Optimization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.