# log_latency

Python API: `modelconverter.utils.log_latency`

Extraction of inference latency from device logs.

The RVC2 and RVC4 benchmarks measure how long a single inference takes by reading the log messages the device emits through
`depthai`. The two platforms word those messages differently, so a regular expression is provided for each.

## Functions

### parse_inference_latency

```python
def parse_inference_latency(log_message: dai.LogMessage, pattern: re.Pattern[str]) -> float | None:
```

Extract an inference duration in milliseconds from a device log message.

Parameters

 * `log_message` (`dai.LogMessage`): Log message received from the device.
 * `pattern` (`re.Pattern[str]`): Regular expression to search the message payload with. Must define a `latency_ms` group.

Returns

 * `float | None`: The latency in milliseconds, or `None` if the payload does not match the pattern.

## Attributes

### RVC2_INFERENCE_LATENCY_RE

### RVC4_INFERENCE_LATENCY_RE
