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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.