CircularAtraceUtil

public class CircularAtraceUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.CircularAtraceUtil


An atrace utility developed primarily for identifying the root causes of ANRs during Monkey testing. Invoking the start command will start asynchronously monitoring the tagged traces in a circular buffer. Invoking stop will dump the contents of the buffer into an InputStreamSource that it returns. To use this for the case mentioned above (identifying ANRs), one has to first implement the start method at the beginning of the test and the end method immediately at the end of the test. From here one can choose how to store and handle the data. Most should probably use the systrace with the --from-file option to generate an HTML viewer.

Summary

Public constructors

CircularAtraceUtil()

Public methods

static FileInputStreamSource endTrace(ITestDevice device)

Stops and dumps atrace asynchronously into a File, which it returns in an InputStreamSource.

static void startTrace(ITestDevice device, List<String> tags, int bufferSizeMB)

Starts atrace asynchronously with the tags specified.

Public constructors

CircularAtraceUtil

CircularAtraceUtil ()

Public methods

endTrace

FileInputStreamSource endTrace (ITestDevice device)

Stops and dumps atrace asynchronously into a File, which it returns in an InputStreamSource.

Parameters
device ITestDevice

Returns
FileInputStreamSource a FileInputStreamSource with the results from the atrace command

Throws
DeviceNotAvailableException
IllegalStateException

startTrace

void startTrace (ITestDevice device, 
                List<String> tags, 
                int bufferSizeMB)

Starts atrace asynchronously with the tags specified.

Parameters
device ITestDevice: the device whose actions will be monitored

tags List: tags that atrace should monitor; defaults to 'am gfx sched view'

bufferSizeMB int: the circular buffers size in MB

Throws
DeviceNotAvailableException
IllegalStateException