Launch Profiler概述
DevEco Studio内置Profiler分析调优工具。其中Launch主要用于分析应用或服务的启动耗时,分析启动周期各阶段的耗时情况、核心线程的运行情况等,协助开发者识别启动缓慢的原因。此外,Launch任务窗口还集成了Time、CPU、Frame场景分析任务的功能,方便开发者在分析启动耗时的过程中同步对比同一时段的其他资源占用情况。
场景示例
如下代码在页面绘制之前的aboutToAppear生命周期函数内执行了耗时的计算任务,导致应用冷启动耗时长,文章后续将以本案例场景来简单介绍Frame Profiler的使用。
@Entry
@Component
struct Index {
@State private text: string = "hello world";
private count: number = 0;
aboutToAppear() {
this.computeTask();
}
build() {
Column({
space: 10}) {
Text(this.text).fontSize(50)
}
.width('100%')
.height('100%')