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

# Get started with performance tuning and optimization

You can use the performance build to measure system performance. Additionally, you can compile the debug tools to analyze and resolve any performance issues.

## **Prerequisites**

To start developing your software using Qualcomm<sup>®</sup> Linux<sup>®</sup>, set up your infrastructure as described in the [Build Qualcomm Linux using Yocto](https://dragonwingdocs.qualcomm.com/Key-Documents/Yocto-Guide/build-qualcomm-linux). The build guide also explains the common build workflows.

## **Key performance indicators (KPIs)**

Key performance indicators (KPIs) are measurable values that indicate how effectively a system is performing against defined objectives. In the context of Qualcomm Linux performance tuning, KPIs help you evaluate whether your system meets performance goals and identify areas for optimization.

The following are the primary KPI categories used in this guide:

* **Boot time** — The time elapsed from power-on to system readiness at various stages, such as the first user-space process start, camera driver initialization, and service target completion.
* **System benchmarks** — Standardized scores that measure CPU, memory, storage, and graphics performance using tools such as Geekbench, CoreMark, Tiotest, GLmark2, Sysbench, and UnixBench.
* **Latency** — The response time for critical operations, such as camera snapshot latency or scheduling latency for real-time tasks.
* **Memory utilization** — The amount of RAM consumed by various system components (kernel, user space, free memory) after boot and during active use cases.
* **Throughput** — The rate at which data is processed or transferred, such as storage I/O rates or memory bandwidth.

## **Performance analysis and tuning process workflow**

The following figure shows a workflow to achieve the expected system performance:

<div className="flex flex-col items-center gap-2">
  <img src="https://mintcdn.com/qualcomm-staging/blZpKs_b9On5nj-y/archives/2.1/System/Performance/media/k2l-performance/qual_linux_perform_workflow.svg?fit=max&auto=format&n=blZpKs_b9On5nj-y&q=85&s=7211028592e314b0d23c7cbe8de73d42" alt="Figure : Workflow to measure the Qualcomm Linux system performance" width="1210" height="310" data-path="archives/2.1/System/Performance/media/k2l-performance/qual_linux_perform_workflow.svg" />

  <p className="text-sm text-gray-700">
    Figure : Workflow to measure the Qualcomm Linux system performance
  </p>
</div>

The workflow diagram summarizes the performance analysis and tuning process in six steps:

1. Prepare a performance build using analysis tools.
2. Measure key performance indicators (KPIs) such as system benchmarks and boot time.
3. Troubleshoot performance issues including CPU workload and memory usage.
4. Apply tuning and customizations to address identified issues.
5. Evaluate KPI targets to determine if performance goals are met. If performance goals aren't met, troubleshoot and tune according to system requirements. This forms an iterative loop for continuous performance improvement.
6. Report unresolved issues at [Qualcomm support](https://www.qualcomm.com/support/).

## **Prepare performance build**

It's recommended to use the performance build for performance measurement or debugging. To prepare a performance build use the following command:

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

Replace `<machine>` with your target machine name, for example `qcs6490-rb3gen2-core-kit.yml`.

For more information, see [Build Qualcomm Linux using Yocto](https://dragonwingdocs.qualcomm.com/Key-Documents/Yocto-Guide/build-qualcomm-linux).

The performance build uses the following kernel configuration fragments from the source code:

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

These kernel configurations are defined in the source code kernel recipe at

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

## **Compile performance tools**

The tools to debug performance issues include LTTng, GCC, G++, htop, perf utility, iotop, and lmbench.

To compile the debug tools, add them to the `qcom-multimedia-image.bb` distribution image in the source code in the following path:

`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
--- a/recipes-products/images/qcom-multimedia-image.bb
+++ b/recipes-products/images/qcom-multimedia-image.bb
@@ CORE_IMAGE_BASE_INSTALL @@
 CORE_IMAGE_BASE_INSTALL += " \
     ...
     wireplumber \
+    lttng-tools \
+    lttng-tools-dev \
+    lttng-modules \
+    lttng-modules-dev \
+    lttng-ust \
+    lttng-ust-dev \
+    liburcu-dev \
+    gcc \
+    g++ \
+    iotop \
+    htop \
+    perf \
+    lmbench \
 "
```

To apply this patch, run `git apply <patch-file>` from the `meta-qcom-distro` directory, or manually add the listed packages to the `CORE_IMAGE_BASE_INSTALL` section in the recipe file.

## **Next steps**

* [Features impacting performance](./features-impacting-performance)
