目录

Parallelism and Concurrency Analysis: Concurrency

Function Description

TaskPool provides a multithreaded environment that helps reduce resource consumption and improve system performance. It eliminates the need for manually managing the lifecycle of thread instances. You can use TaskPool APIs to create background tasks and perform operations on them, for example, executing or canceling a task.

With the Concurrency analysis feature provided by DevEco Profiler, you can record key data for parallelism and concurrency, and analyze performance issues such as the lifecycle, throughput, and latency of tasks. The Concurrency template displays information about ArkTS asynchronous APIs, asynchronous Node-APIs, TaskPool, and FFRT concurrency models.

The Concurrency template supports the following lanes: FFRT, TaskPool, Async NAPI, Async ArkTS, ArkTS Callstack, Callstack, and Process. This section describes the FFRT, TaskPool, Async NAPI, and Async ArkTS lanes. For details about other lanes, see the corresponding template.

Before analysis, create a Concurrency analysis task and capture related data. For details, see In-depth Capture for Problem Locating. Alternatively, click Open File in the session area and import historical data.

Viewing Task Statistics

  1. Select a specific lane, and use the options drop-down list box to filter different processes.

  2. Select a time range within the sub-lane, and the Details panel will display the statistics of parallel and concurrent tasks in the corresponding execution state for that time range.
  3. Click the redirection button next to a task name to jump to the corresponding task lane.

Viewing All States of a Task

  1. Select a specific lane, and use the options drop-down list box to filter different processes.

  2. Select a time range in the sub-lane to view the task status within the selected time range.
  3. Click the redirection button next to the task name to jump to the corresponding thread lane, where you can view the trace file's markers within the execution time range of the task, reflecting the function execution of the thread during that period.

  4. Expand the Async ArkTS lane to view details of ArkTS asynchronous call tasks individually.

  5. Expand the Async NAPI lane to view details of Node-API asynchronous call tasks individually.

Viewing a Specific State of a Task

Click an execution node in the Task sub-lane, and the Details panel will display detailed information about the task in that specific state.