# ProfileRow

> Typed profile block derived once from the Yii logger timings and persisted in that form.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [Profile](/docs/extensions/debug-core/reference/panel/profile/index.md) › ProfileRow

| final readonly class | `PHPForge\Debug\Panel\Profile\ProfileRow` |
| --- | --- |
| Implements | [`PHPForge\Debug\Storage\PanelRow`](/docs/extensions/debug-core/reference/storage/panelrow/index.md) |
| Source | [`src/Panel/Profile/ProfileRow.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/Profile/ProfileRow.php#L16) |

Typed profile block derived once from the Yii logger timings and persisted in that form.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-category"></span>`$category` readonly constructor | `string` | Profile category attached to the `Yii::beginProfile()` token. | `ProfileRow` |
| <span id="property-duration"></span>`$duration` readonly constructor | `float` | Block execution time in milliseconds. | `ProfileRow` |
| <span id="property-info"></span>`$info` readonly constructor | `string` | Profile token / informational label captured at `Yii::beginProfile()`. | `ProfileRow` |
| <span id="property-level"></span>`$level` readonly constructor | `int` | Nesting level of the block, used to render an indentation arrow per level. | `ProfileRow` |
| <span id="property-memory"></span>`$memory` readonly constructor | `int` | Peak memory in bytes recorded when the block closed. | `ProfileRow` |
| <span id="property-memoryDiff"></span>`$memoryDiff` readonly constructor | `int` | Memory delta in bytes between the block's begin and end markers. | `ProfileRow` |
| <span id="property-seq"></span>`$seq` readonly constructor | `int` | Zero-based sequence index assigned in capture order. | `ProfileRow` |
| <span id="property-timestamp"></span>`$timestamp` readonly constructor | `float` | Capture timestamp in milliseconds since the Unix epoch. | `ProfileRow` |
| <span id="property-trace"></span>`$trace` readonly constructor | `list<array<string, mixed>>` | Backtrace frames captured at the `Yii::beginProfile()` call site. | `ProfileRow` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a profile row from captured timing data. | `ProfileRow` |
| [`fromArray()`](#method-fromArray) static | Narrows one persisted block of the profiling payload into a typed row. | `ProfileRow` |
| [`fromTiming()`](#method-fromTiming) static | Converts one timing returned by [`ProfileTimings::calculate()`](/docs/extensions/debug-core/reference/panel/profile/profiletimings/index.md#method-calculate) into a typed row. | `ProfileRow` |
| [`jsonSerialize()`](#method-jsonSerialize) | Returns the typed row for JSON serialization. | `ProfileRow` |
| [`maxDuration()`](#method-maxDuration) static | Returns the longest block duration in milliseconds, or `0.0` when there are no rows. | `ProfileRow` |

## Method details

### __construct() <span id="method-__construct"></span>

```php
public function __construct(float $timestamp, float $duration, string $category, string $info, int $level, int $seq, int $memory, int $memoryDiff, array $trace)
```

Creates a profile row from captured timing data.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$timestamp` | `float` |  |
| `$duration` | `float` |  |
| `$category` | `string` |  |
| `$info` | `string` |  |
| `$level` | `int` |  |
| `$seq` | `int` |  |
| `$memory` | `int` |  |
| `$memoryDiff` | `int` |  |
| `$trace` | `array` |  |

### fromArray() <span id="method-fromArray"></span>

```php
public static function fromArray(mixed $data, string $path): self
```

Narrows one persisted block of the profiling payload into a typed row.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$data` | `mixed` | Persisted block, expected to be an object carrying the declared shape. |
| `$path` | `string` | JSON path of the block, used to report a malformed payload. |

**Returns**

`self`: Row carrying every persisted block field.

### fromTiming() <span id="method-fromTiming"></span>

```php
public static function fromTiming(PHPForge\Debug\Panel\Profile\ProfileTiming $timing, int $seq): self
```

Converts one timing returned by [`ProfileTimings::calculate()`](/docs/extensions/debug-core/reference/panel/profile/profiletimings/index.md#method-calculate) into a typed row.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$timing` | `PHPForge\Debug\Panel\Profile\ProfileTiming` | Profile timing entry. |
| `$seq` | `int` | Zero-based sequence index to assign. |

**Returns**

`self`

### jsonSerialize() <span id="method-jsonSerialize"></span>

```php
public function jsonSerialize(): array<string, mixed>
```

Returns the typed row for JSON serialization.

**Returns**

`array<string, mixed>`

### maxDuration() <span id="method-maxDuration"></span>

```php
public static function maxDuration(list<self> $rows): float
```

Returns the longest block duration in milliseconds, or `0.0` when there are no rows.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$rows` | `list<self>` | Captured profile rows. |

**Returns**

`float`