The first frame completion delay of an app during cold start is the period from the time when a user touches the app icon on the home screen to the time when the first frame of the app process is drawn. This case describes how to find the start and end points of the first frame completion delay of an app during cold start, and how to analyze the app runtime logic based on the call stack and trace information to locate the cause of the unexpected first frame completion delay.
For details about the basic operations related to app cold start analysis, see Basic Operations with Launch Analysis.
To analyze the first frame completion delay during cold start, perform the following steps:
to switch the launch mode to
manual launch.
and select HiTrace > multimodalinput to collect trace information of the multimodal subsystem. The information includes the finger-off signal transferred by the hardware, that is, the touch release event received by the multimodal subsystem.
to start recording. After the dialog box is displayed, click the app icon on the device to launch the app.

Determining the start point of the first frame completion delay during cold start
The start point of the first frame completion delay is the moment when the user releases the touch on the app icon on the home screen, that is, the moment when the multimodal subsystem receives the finger-off signal from the hardware.
Since the trace point corresponding to the off-screen signal has a short duration and is difficult to remember, you should first locate the trace point (H:DispatchTouchEvent) at which the launcher process receives the touch-up event, to help identify the start point of the first-frame completion latency. The procedure is as follows:
or
button to find the H:DispatchTouchEvent point within the launcher process lane (ohos.sceneboard) where type is 1 (0: finger down; 1: finger up; 2: move). Add a marker to this point. Double-click the marker and edit its description to "Touch release event" in the property dialog for future reference. This trace point marks the moment the launcher process receives the touch release event. 
or
button to identify the mmi_service lane containing the target trace segment.
Specifically, within the mmi_service lane, identify the CPU Running slice positioned prior to the touch release marker (indicating subsystem activity during this period). Below this slice, find the trace point labeled H:service report touchId:{id}, type: up or H:service report pointerId:{id}, type: button-up. Add a marker to this trace point. Modify the marker's description to "Start point of first frame completion latency." This trace point marks the multimodal subsystem receiving the touch release event, that is, the start point of the first frame completion latency during cold start.

Determining the end point of the first frame completion delay during cold start
The end point of the first frame completion delay is the time when the first hardware vertical sync signal is received after the application process starts, that is, the end point when the Render Service (unified rendering service process) displays the rendering result of the application's first frame on the screen. To locate the end point of the first frame completion delay, perform the following steps:



next to Name in the Slice Detail panel to navigate to the H:RSMainThread::ProcessCommandUni trace point in the render_service lane. Add a marker to this point and modify its description to "Rendering callback received." This trace point indicates that the Render Service process has received the first frame rendering notification from the application process. 


Select the start and end points of the first frame completion delay during cold start of the application. The duration within the selected range reveals that the actual delay exceeds 800 ms, surpassing the expected 600 ms.
Switch to the Process lane and view the trace of the main thread (whose thread ID is the same as the process ID).

The Details area displays the trace name, start time, and duration. Sort the durations in descending order to identify that the main time consumption occurs in H:void OHOS::AbilityRuntime::UIAbilityThread::HandleAbilityTransaction. This phase primarily involves the execution of callback functions during the launch lifecycle of AbilityStage/Ability. From this, it can be inferred that the prolonged execution of AbilityStage/Ability launch lifecycle callbacks is the root cause. Next, analyze the call stack to determine why these callbacks take excessive time.

Switch to the ArkTS Callstack lane to analyze the time-consuming functions on the ArkTS side. First, check the ArkVM sub-lane whose thread ID matches the process ID (this sub-lane represents the main thread call stack) to view the execution time of ArkTS methods. As shown in the figure below, no ArkTS functions are executed, so you need to switch to the Callstack lane to view the mixed ArkTS-Native function call stack.

Finally, switch to the Callstack lane, check the main thread sub-lane (whose thread ID matches the process ID), and view the Heaviest Stack section below. Scroll to observe the function call stack with the highest weight percentage, and identify that the main time consumption is caused by the code on line 79 of the EntryAbility.ets file. Double-clicking this stack frame will directly navigate to the corresponding position in the source code file.

By examining the service code, it is found that time-consuming operations are performed in the onCreate() method in the EntryAbility.ets file. You are advised to handle time-consuming operations through asynchronous tasks with delayed processing or execute them on separate threads to reduce main thread load and shorten the first frame completion delay during cold start.
