How to See the Snapshot That Some Sends Again on Android

Devices running Android 9 (API level 28) or higher include a organization-level app called System Tracing. This app is similar to the systrace command-line utility, simply the app allows yous to record traces direct from a test device itself, without needing to plug in the device and connect to it over ADB. You can and so use the app to share results from these traces with your development team.

It's peculiarly helpful to record traces when addressing functioning-related bugs in your app, such equally slow startup, slow transitions, or UI jank.

Record a system trace

The System Tracing app allows you lot to record a organization trace using a Quick Settings tile or a bill of fare inside the app itself. The post-obit sections describe how to complete the recording procedure using these interfaces.

Record using Quick Settings tile

The Quick Settings tile is usually the more than convenient way to complete the on-device arrangement tracing procedure.

Ready upwardly tile

Effigy 2. The Show Quick Settings tile switch in the System Tracing app

If you're using System Tracing for the get-go time on your exam device, or if you don't see the System Tracing tile in your device's Quick Settings panel (Figure ane), consummate the post-obit setup steps:

  1. Enable programmer options, if you lot haven't done and then already.
  2. Open the Developer Options settings screen.
  3. In the Debugging section, select System Tracing. The System Tracing app opens, showing the app menu.
  4. From the app menu, enable Show Quick Settings tile, as shown in Figure 2. The organisation adds the System Tracing tile to the Quick Settings panel, which appears in Effigy ane:

    Figure 1. The Organisation Tracing tile inside the Quick Settings panel

    Annotation: By default, the system adds the System Tracing tile as the first tile in the Quick Settings panel. If you'd like the tile to appear in a different position, employ the console's edit mode to move the tile.

Complete a organization trace recording

To record a system trace using the Quick Settings panel, complete the post-obit steps:

  1. Tap the System Tracing tile, which has the label "Record trace". The tile becomes enabled, and a persistent notification appears to notify you that the system is now recording a trace, every bit shown in Effigy 3:

    Notification with the message 'Trace is being recorded. Tap to stop    tracing.'
    Effigy 3. Persistent notification that appears afterwards starting an on-device system trace
  2. Perform the deportment in your app that you'd like the arrangement to inspect.

  3. When you've completed these actions, end tracing by tapping either the System Tracing tile in the Quick Settings console or on the System Tracing notification.

    The system displays a new notification that contains the message "Saving trace". When saving is complete, the organisation dismisses the notification and displays a third notification, confirming that your trace has been saved and that you're ready to share the organisation trace, every bit shown in Figure four:

    Notification with the message 'Trace saved. Tap to share your    trace.'
    Figure 4. Persistent notification that appears subsequently the organisation has finished saving a recorded trace

The app carte du jour allows y'all to configure several advanced settings related to organization tracing and provides a switch for starting and stopping a system trace.

To tape a system trace using the System Tracing app bill of fare, complete the post-obit steps:

  1. Enable developer options, if you lot haven't done so already.
  2. Open the Developer Options settings screen. In the Debugging section, select System Tracing. The System Tracing app opens.

    Alternatively, if yous've set up the System Tracing tile, you can long-tap on the tile to enter the Arrangement Tracing app.

  3. Brand sure Trace debuggable applications is selected to include applications that have debugging enabled in the organization trace.

  4. Optionally, choose the Categories of system and sensor calls to trace, and choose a Per-CPU buffer size (in KB). Choose categories that represent to the use case that you lot're testing, such every bit the Audio category for testing Bluetooth operations or the Retention category for heap allocations.

    Figure 5. The Record trace switch in the System Tracing app
  5. Optionally, select Long traces to enable traces that are saved continuously to device storage. For this pick, you lot must prepare limits for the Maximum long trace size and Maximum long trace duration.

  6. Enable the Record trace switch, highlighted in Figure 5. The tile becomes enabled, and a persistent notification appears to notify you that the organisation is now recording a trace (Effigy three).

  7. Perform the actions in your app that you'd similar the organisation to audit.

  8. When yous've completed these actions, terminate tracing by disabling the Tape trace switch.

    The system displays a new notification that contains the message "Saving trace". When saving is complete, the system dismisses the notification and displays a third notification, confirming that your trace has been saved and that you're ready to share the system trace, as shown in Figure 4.

The System Tracing app helps y'all share system trace results as function of several dissimilar workflows. On a device running Android 10 (API level 29) or later, trace files are saved with the .perfetto-trace filename extension and tin can be opened in the Perfetto UI. On a device running an before version of Android, trace files are saved with the .ctrace filename extension, which denotes the Systrace format.

Organisation Tracing allows yous to share your collected trace with other apps on your device. In doing so, you can send the trace to your development team through an email or a bug-tracking app without needing to connect a device to your development machine.

Later on y'all've recorded a arrangement trace, tap on the notification that appears on the device (see Figure four). The platform'southward intent picker appears, assuasive you to share your trace using the messaging app of your option.

On devices running Android x (API level 29), traces are shown in the Files app. If desired, you can share a trace from this app.

Download written report using ADB

If desired, yous can also extract a system trace from a device using ADB. Connect the device that recorded the trace to your development machine, and then run the following commands in a terminal window:

cd /path-to-traces-on-my-dev-machine          && \   adb pull /data/local/traces/ .

Converting between trace formats

You can convert Perfetto trace files to the Systrace format. Run across Converting betwixt trace formats for more than information.

Create an HTML study

When sharing your trace, the report itself resides in a .perfetto-trace file (on devices running Android 10 or college) or a .ctrace file (for all other versions).

Create an HTML written report from the trace file using a web-based UI or from the command line.

Web-based UI

Use the Perfetto UI to open the trace file and generate the report.

For a Perfetto file, click Open trace file. For a Systrace file, click Open up with legacy UI. The legacy UI has the same look and feel as the Systrace report.

Command line

Run the post-obit commands in a final window to generate an HTML study from the trace file:

cd /path-to-traces-on-my-dev-machine          && \   systrace --from-file          trace-file-proper name{.ctrace | .perfetto-trace}

If you don't already have the systrace command-line program, you can download it from the Catapult projection on GitHub, or direct from the Android Open Source Projection.

brownmandre74.blogspot.com

Source: https://developer.android.com/topic/performance/tracing/on-device

0 Response to "How to See the Snapshot That Some Sends Again on Android"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel