> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 开始进行性能调优与优化

您可以使用性能构建来测量系统性能。此外，您还可以编译调试工具，以分析并解决任何性能问题。

## **前提条件**

要开始使用 Qualcomm<sup>®</sup> Linux<sup>®</sup> 开发软件，请按照[使用 Yocto 构建 Qualcomm Linux](https://dragonwingdocs.qualcomm.com/Key-Documents/Yocto-Guide/build-qualcomm-linux) 中的说明搭建基础环境。构建指南还介绍了常见的构建工作流程。

## **性能分析与调优流程工作流**

下图展示了实现预期系统性能的工作流程：

<div className="flex flex-col items-center gap-2">
  <img src="https://mintcdn.com/qualcomm-prod/OKFyShYzKWv2bmj8/System/Performance/media/k2l-performance/qual_linux_perform_workflow.svg?fit=max&auto=format&n=OKFyShYzKWv2bmj8&q=85&s=1ef1fca0a6f1a8a41c923cf740f221be" alt="图：测量 Qualcomm Linux 系统性能的工作流程" width="1210" height="310" data-path="System/Performance/media/k2l-performance/qual_linux_perform_workflow.svg" />

  <p className="text-sm text-gray-700">
    图：测量 Qualcomm Linux 系统性能的工作流程
  </p>
</div>

该工作流程图将性能分析与调优过程归纳为六个步骤：

1. 使用分析工具准备性能构建。
2. 测量关键性能指标（KPI），如系统基准测试和启动时间。
3. 排查性能问题，包括 CPU 工作负载和内存使用情况。
4. 应用调优和定制以解决已识别的问题。
5. 评估 KPI 目标以确定是否达到性能目标。如果未达到性能目标，请根据系统需求进行排查和调优。这构成了一个持续性能改进的迭代循环。
6. 将未解决的问题报告至 [Qualcomm support](https://www.qualcomm.com/support/)。

## **准备性能构建**

建议使用性能构建进行性能测量或调试。要准备性能构建，请使用以下命令：

```text theme={null}
kas build meta-qcom/ci/<machine>.yml:meta-qcom/ci/qcom-distro.yml:meta-qcom/ci/performance.yml
```

更多信息请参见[使用 Yocto 构建 Qualcomm Linux](https://dragonwingdocs.qualcomm.com/Key-Documents/Yocto-Guide/build-qualcomm-linux)。

性能构建使用源代码中的以下内核配置片段：

`meta-qcom/recipes-kernel/linux/linux-qcom-6.18/configs/bsp-additions.cfg`

这些内核配置在源代码内核 recipe 中定义，路径为

`meta-qcom/recipes-kernel/linux/linux-qcom_6.18.bb`

## **编译性能工具**

用于调试性能问题的工具包括 LTTng、GCC、G++、htop、perf 实用工具、iotop 和 lmbench。

要编译这些调试工具，请将它们添加到源代码中以下路径下的 `qcom-multimedia-image.bb` 发行版镜像中：

`meta-qcom-distro/recipes-products/images/`

```text theme={null}
diff --git a/recipes-products/images/qcom-multimedia-image.bb b/recipes-products/images/qcom-multimedia-image.bb
index 23a2f40..5295bf9 100644
--- a/recipes-products/images/qcom-multimedia-image.bb
+++ b/recipes-products/images/qcom-multimedia-image.bb
@@ -10,4 +10,20 @@ REQUIRED_DISTRO_FEATURES += "wayland"
CORE_IMAGE_BASE_INSTALL += " \
     packagegroup-qcom-multimedia \
     packagegroup-qcom-iot-base-utils \
+     lttng-tools \
+     lttng-tools-dev \
+     lttng-modules \
+     lttng-modules-dev \
+     lttng-ust \
+     lttng-ust-dev \
+     liburcu-dev \
+     gcc \
+     g++ \
+     iotop \
+     htop \
+     perf \
+     lmbench \
"
```

## **后续步骤**

* [影响性能的功能](./features-impacting-performance)
