Skip to content
PHP Ecosystem
Explore

ProfilingSnapshot

API reference › Debug Core › Panel › Profile › ProfilingSnapshot

final readonly classPHPForge\Debug\Panel\Profile\ProfilingSnapshot
ImplementsPHPForge\Debug\Storage\PanelSnapshot
Sourcesrc/Panel/Profile/ProfilingSnapshot.php

Canonical profiling snapshot holding the request metrics, the resolved profile blocks, and the memory samples that feed the timeline chart.

PropertyTypeDescriptionDefined by
$memory readonly constructorintPeak memory in bytes recorded for the request.ProfilingSnapshot
$time readonly constructorfloatRequest processing duration in seconds.ProfilingSnapshot
MethodDescriptionDefined by
__construct()Creates a profiling snapshot from request metrics, blocks, and memory samples.ProfilingSnapshot
capture() staticResolves the logger’s begin/end pairs into typed blocks and collects the per-message memory samples.ProfilingSnapshot
captureCompleted() staticNormalizes completed profiler messages carrying token, category, timing, nesting, memory, and trace context.ProfilingSnapshot
entries()Returns the resolved profile blocks.ProfilingSnapshot
fromArray() staticNarrows the persisted profiling payload into a typed snapshot.ProfilingSnapshot
jsonSerialize()Returns the panel snapshot for JSON serialization.ProfilingSnapshot
samples()Returns the memory samples that feed the timeline chart.ProfilingSnapshot
public function __construct(int $memory, float $time, list<PHPForge\Debug\Panel\Profile\ProfileRow> $entries, list<PHPForge\Debug\Panel\MemorySample> $samples)

Creates a profiling snapshot from request metrics, blocks, and memory samples.

Parameters

ParameterTypeDescription
$memoryint
$timefloat
$entrieslist<ProfileRow>
$sampleslist<PHPForge\Debug\Panel\MemorySample>
public static function capture(int $memory, float $time, list<PHPForge\Debug\Panel\Profile\LogTuple> $messages): self

Resolves the logger’s begin/end pairs into typed blocks and collects the per-message memory samples.

Parameters

ParameterTypeDescription
$memoryint
$timefloat
$messageslist<PHPForge\Debug\Panel\Profile\LogTuple>Profile tuples in capture order.

Returns

self

public static function captureCompleted(int $memory, float $time, array<int|string, mixed> $messages): self

Normalizes completed profiler messages carrying token, category, timing, nesting, memory, and trace context.

Parameters

ParameterTypeDescription
$memoryint
$timefloat
$messagesarray<int|string, mixed>Completed profiler messages.

Returns

self

public function entries(): list<PHPForge\Debug\Panel\Profile\ProfileRow>

Returns the resolved profile blocks.

Returns

list<ProfileRow>: Resolved profile blocks in capture order.

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

Narrows the persisted profiling payload into a typed snapshot.

Parameters

ParameterTypeDescription
$datamixedPersisted payload, expected to be an object carrying the declared shape.
$pathstringJSON path of the payload, used to report a malformed capture.

Returns

self: Snapshot carrying the request metrics, the profile blocks, and the memory samples.

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

Returns the panel snapshot for JSON serialization.

Returns

array<string, mixed>

public function samples(): list<PHPForge\Debug\Panel\MemorySample>

Returns the memory samples that feed the timeline chart.

Returns

list<PHPForge\Debug\Panel\MemorySample>: Memory readings recorded alongside each captured profile message.