# Profiling

After output validation, measure the model on the board under recorded build
and runtime conditions. This step is optional: conversion and firmware
compilation do not establish timing or energy results.

## What you need

Use a supported board, J-Link connection and Arm toolchain. Follow the
[profiler installation guide](https://ambiqai.github.io/helia-profiler/getting-started/install/)
for the profiler's version and environment requirements. Its AOT integration is
installed in a Python environment with:

```sh
pip install 'helia-profiler[aot]'
hpx doctor
```

Resolve missing prerequisites before profiling. Profiling can generate and build
another module; retain its effective configuration and versions instead of
assuming it is the identical binary used in the previous validation.

## Run and compare

The [measurement guide](https://ambiqai.github.io/helia-aot/guide/measure/) is the complete configuration
and interpretation procedure. The repository's
[profile-with-hpx example](https://github.com/AmbiqAI/helia-aot/tree/main/examples/profile-with-hpx)
provides paired KWS configurations. Run from that example's directory after
fetching its model, or use equivalent paths in your own saved configurations.

The profile commands **program and execute on the connected board**:

```sh
hpx profile --config hpx_rt.yml
hpx profile --config hpx_aot.yml
hpx compare results/comparison_rt results/comparison_aot --output-dir results/rt-vs-aot
```

Compare the same model bytes, board, clocks, memory placement, library/toolchain
settings and iteration/warmup policy. Read whole-inference timing before layer
measurements. Different operator sequences can prevent meaningful layer pairing.
Keep raw results and tool/configuration versions with the comparison.

Power and energy require a supported power monitor, correct wiring and profiler
configuration. Follow the profiler's
[power guide](https://ambiqai.github.io/helia-profiler/guide/power/) for that setup;
a debug probe alone does not measure power.

## Where to go next

- [Measurement guide](https://ambiqai.github.io/helia-aot/guide/measure/) for the full procedure.
- [Guides](https://ambiqai.github.io/helia-aot/guide/) for memory and deployment changes.
- [Reference](https://ambiqai.github.io/helia-aot/reference/) for exact settings and generated interfaces.
