{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
class AtraceLogger
Class contains helper methods to dump atrace info asynchronously while running the test case.
This API is currently in beta.
Public constructors |
|
|---|---|
Public functions |
|
|---|---|
Unit |
atraceStart(Method to start atrace and dump the data at regular interval. |
Unit |
Method to stop the atrace and write the atrace data cached in byte array list to file. |
java-static AtraceLogger! |
getAtraceLoggerInstance(instrumentation: Instrumentation!)To make sure only one instance of atrace logger is created. |
fun atraceStart(
traceCategoriesSet: (Mutable)Set<String!>!,
atraceBufferSize: Int,
dumpIntervalSecs: Int,
destDirectory: File!,
traceFileName: String!
): Unit
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: (Mutable)Set<String!>! |
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 | |
|---|---|
java.io.IOException: java.io.IOException |
|
fun atraceStop(): Unit
Method to stop the atrace and write the atrace data cached in byte array list to file.
| Throws | |
|---|---|
java.io.IOException: java.io.IOException |
|
java.lang.InterruptedException: java.lang.InterruptedException |
|
java-static fun getAtraceLoggerInstance(instrumentation: Instrumentation!): AtraceLogger!
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 |