Summary: Methods | Inherited Methods | [Expand All]

# AtraceLogger

`public class AtraceLogger`
`extends Object` ``

java.lang.Object
↳ | android.support.test.rule.logging.AtraceLogger

Class contains helper methods to dump atrace info asynchronously while running the test case

## Summary

### Public methods
`void` | `atraceStart(Set<String> traceCategoriesSet, int atraceBufferSize, int dumpIntervalSecs, File destDirectory, String traceFileName)` Method to start atrace and dump the data at regular interval.
`void` | `atraceStop()` Method to stop the atrace and write the atrace data cached in byte array list to file.
`static AtraceLogger` | `getAtraceLoggerInstance(Instrumentation instrumentation)` To make sure only one instance of atrace logger is created.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()`
`boolean` | `equals(Object arg0)`
`void` | `finalize()`
`final Class<?>` | `getClass()`
`int` | `hashCode()`
`final void` | `notify()`
`final void` | `notifyAll()`
`String` | `toString()`
`final void` | `wait(long arg0, int arg1)`
`final void` | `wait(long arg0)`
`final void` | `wait()`

## Public methods

### atraceStart

    void atraceStart (Set<String> traceCategoriesSet,
                    int atraceBufferSize,
                    int dumpIntervalSecs,
                    File destDirectory,
                    String traceFileName)

Method to start atrace and dump the data at regular interval. Note : Trace info will not be captured during the dumping if there are multiple dumps between the atraceStart and atraceStop

Parameters
`traceCategoriesSet` | `Set`: Set of atrace categories (i.e atrace --list_categories)
`atraceBufferSize` | `int`: Size of the circular buffer in kb
`dumpIntervalSecs` | `int`: Periodic interval to dump data from circular buffer
`destDirectory` | `File`: Directory under which atrace logs are stored
`traceFileName` | `String`: is optional parameter.Atrace files are dumped under destDirectory. traceFileName will be indexed based on number of dumps between atraceStart and atraceStop under destDirectory. If traceFileName is null or empty "atrace" name will be used for indexing the files and stored under destDirectory

Throws
`IOException` |

### atraceStop

    void atraceStop ()

Method to stop the atrace and write the atrace data cached in byte array list to file.

Throws
`` | IOException
`InterruptedException` |
`IOException` |

### getAtraceLoggerInstance

    AtraceLogger getAtraceLoggerInstance (Instrumentation instrumentation)

To make sure only one instance of atrace logger is created. Note : Supported only for minsdk version 23 and above because of UiAutomation executeShellCommand limitation.

Parameters
`instrumentation` | `Instrumentation`: Used to execute atrace shell commands

Returns
`AtraceLogger` | instance of the AtraceLogger

- ## Classes

  - AtraceLogger
  - EnableTestTracingRule
  - LogBatteryInformationRule
  - LogDeviceGetPropInfoRule
  - LoggingBaseRule
  - LogGraphicsStatsRule
  - LogLogcatRule
  - LogNetStatsRule
  - RuleLoggingUtils