# TraceCompat

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Methods](https://developer.android.com/reference/android/support/v4/os/TraceCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/os/TraceCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/os/TraceCompat#)  

# TraceCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
TraceCompat
`  
`

extends Object


``


`

|---|-----------------------------------|
| java.lang.Object                     ||
| ↳ | android.support.v4.os.TraceCompat |

<br />

*** ** * ** ***

Writes trace events to the system trace buffer. These trace events can be collected and visualized using the Systrace tool.

This tracing mechanism is independent of the method tracing mechanism offered by[startMethodTracing()](https://developer.android.com/reference/android/os/Debug.html#startMethodTracing()). In particular, it enables tracing of events that occur across multiple processes.

For information about using the Systrace tool, read[Analyzing Display and Performance with Systrace](https://developer.android.com/tools/debugging/systrace).

## Summary

|                                                                                                              ### Public methods                                                                                                               ||
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static void` | ` `[beginSection](https://developer.android.com/reference/android/support/v4/os/TraceCompat#beginSection(java.lang.String))`(String sectionName) ` Writes a trace message to indicate that a given section of code has begun. |
| ` static void` | ` `[endSection](https://developer.android.com/reference/android/support/v4/os/TraceCompat#endSection())`() ` Writes a trace message to indicate that a given section of code has ended.                                       |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/os/TraceCompat#)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

### beginSection

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void beginSection (String sectionName)
```

Writes a trace message to indicate that a given section of code has begun. This call must be followed by a corresponding call to[endSection()](https://developer.android.com/reference/android/support/v4/os/TraceCompat#endSection())on the same thread.

At this time the vertical bar character '\|', newline character '\\n', and null character '\\0' are used internally by the tracing mechanism. If sectionName contains these characters they will be replaced with a space character in the trace.

<br />

|                                                              Parameters                                                               ||
|---------------|------------------------------------------------------------------------------------------------------------------------|
| `sectionName` | `String`: The name of the code section to appear in the trace. This may be at most 127 Unicode code units long. <br /> |

### endSection

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void endSection ()
```

Writes a trace message to indicate that a given section of code has ended. This call must be preceeded by a corresponding call to[beginSection(String)](https://developer.android.com/reference/android/support/v4/os/TraceCompat#beginSection(java.lang.String)). Calling this method will mark the end of the most recently begun section of code, so care must be taken to ensure that beginSection / endSection pairs are properly nested and called from the same thread.

<br />

-

  ## Interfaces

  - [CancellationSignal.OnCancelListener](https://developer.android.com/reference/android/support/v4/os/CancellationSignal.OnCancelListener)
  - [ParcelableCompatCreatorCallbacks](https://developer.android.com/reference/android/support/v4/os/ParcelableCompatCreatorCallbacks)
-

  ## Classes

  - [BuildCompat](https://developer.android.com/reference/android/support/v4/os/BuildCompat)
  - [CancellationSignal](https://developer.android.com/reference/android/support/v4/os/CancellationSignal)
  - [ConfigurationCompat](https://developer.android.com/reference/android/support/v4/os/ConfigurationCompat)
  - [EnvironmentCompat](https://developer.android.com/reference/android/support/v4/os/EnvironmentCompat)
  - [LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)
  - [ParcelableCompat](https://developer.android.com/reference/android/support/v4/os/ParcelableCompat)
  - [TraceCompat](https://developer.android.com/reference/android/support/v4/os/TraceCompat)
  - [UserManagerCompat](https://developer.android.com/reference/android/support/v4/os/UserManagerCompat)
-

  ## Exceptions

  - [OperationCanceledException](https://developer.android.com/reference/android/support/v4/os/OperationCanceledException)