# helia_aot.optimization.measurements

Measured gains and accuracy costs of setting values, read from a data file.

The records live in ``measurements.json`` next to this module, one per setting
value, target and library version, so new measurements (for example ones
helia-profiler generates) are data changes, not code changes. The report quotes
a record only for the target and core it was measured on and never
extrapolates, not even to another target with the same core.

Copyright 2025 Ambiq. All Rights Reserved.

## helia_aot.optimization.measurements.MeasurementRecord

`class` · `python`

```python
MeasurementRecord()
```

One measured result of a setting value.

Source: `helia_aot/optimization/measurements.py:23`

### helia_aot.optimization.measurements.MeasurementRecord.model_config

`attribute` · `python`

```python
model_config = ConfigDict(extra='forbid', frozen=True)
```

Source: `helia_aot/optimization/measurements.py:26`

### helia_aot.optimization.measurements.MeasurementRecord.setting

`attribute` · `python`

```python
setting: str = Field(..., description='Setting name, e.g. accumulation or constant_placement')
```

Source: `helia_aot/optimization/measurements.py:28`

### helia_aot.optimization.measurements.MeasurementRecord.value

`attribute` · `python`

```python
value: str = Field(..., description='The setting value measured')
```

Source: `helia_aot/optimization/measurements.py:29`

### helia_aot.optimization.measurements.MeasurementRecord.target

`attribute` · `python`

```python
target: str = Field(..., description='Registered target the measurement ran on')
```

Source: `helia_aot/optimization/measurements.py:30`

### helia_aot.optimization.measurements.MeasurementRecord.core

`attribute` · `python`

```python
core: str = Field(..., description="CPU core, as in the platform's cpu")
```

Source: `helia_aot/optimization/measurements.py:31`

### helia_aot.optimization.measurements.MeasurementRecord.cmsis_nn

`attribute` · `python`

```python
cmsis_nn: str = Field(..., description='ns-cmsis-nn version')
```

Source: `helia_aot/optimization/measurements.py:32`

### helia_aot.optimization.measurements.MeasurementRecord.helia_aot

`attribute` · `python`

```python
helia_aot: str = Field(..., description='heliaAOT version')
```

Source: `helia_aot/optimization/measurements.py:33`

### helia_aot.optimization.measurements.MeasurementRecord.subject

`attribute` · `python`

```python
subject: str = Field(..., description='What was measured')
```

Source: `helia_aot/optimization/measurements.py:34`

### helia_aot.optimization.measurements.MeasurementRecord.gain

`attribute` · `python`

```python
gain: str = Field(..., description='The measured speed change')
```

Source: `helia_aot/optimization/measurements.py:35`

### helia_aot.optimization.measurements.MeasurementRecord.accuracy

`attribute` · `python`

```python
accuracy: str = Field(..., description="The measured accuracy cost, or 'exact'")
```

Source: `helia_aot/optimization/measurements.py:36`

### helia_aot.optimization.measurements.MeasurementRecord.conditions

`attribute` · `python`

```python
conditions: str = Field(..., description='Board, clock and method')
```

Source: `helia_aot/optimization/measurements.py:37`

### helia_aot.optimization.measurements.MeasurementRecord.source

`attribute` · `python`

```python
source: str = Field(..., description='Where the measurement is recorded')
```

Source: `helia_aot/optimization/measurements.py:38`

### helia_aot.optimization.measurements.MeasurementRecord.generated_by

`attribute` · `python`

```python
generated_by: str = Field(..., description='Tool or process that produced the record')
```

Source: `helia_aot/optimization/measurements.py:39`

## helia_aot.optimization.measurements.load_measurements

`function` · `python`

```python
load_measurements() -> tuple[MeasurementRecord, ...]
```

Load the packaged measurement records.

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | tuple[MeasurementRecord, ...] | tuple[MeasurementRecord, ...]: Every record in the data file. |

**Raises**

| Name | Description |
| --- | --- |
| ValueError | When the file's format version is not supported. |

Source: `helia_aot/optimization/measurements.py:49`

## helia_aot.optimization.measurements.measurements_for

`function` · `python`

```python
measurements_for(setting: str, target: str, core: str) -> list[MeasurementRecord]
```

Records of a setting measured on ``target`` and ``core``.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| setting | str | Required | The setting name. |
| target | str | Required | The canonical target name. |
| core | str | Required | The target's CPU core. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | list[MeasurementRecord] | list[MeasurementRecord]: Matching records, possibly empty. |

Source: `helia_aot/optimization/measurements.py:70`
