FUIPerformanceTrace
in package
Table of Contents
Constants
- LINE_LENGTH = 80
Properties
- $renderCalls : int
- The number of render method calls
- $sizeCalls : int
- The number of getEstimatedSize method calls
- $totalCalls : int
- The total number of method calls
- $totalRenderTimeMs : float
- The total render time in milliseconds of the full trace
- $totalViews : int
- The total number of unique views that were traced
- $hierarchicalData : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructor
- getHierarchicalData() : array<string, mixed>
- Get the hierarchical data
- getRawData() : array<string|int, array{method: string, class: string, proxy_class: string, duration_ns: int, duration_ms: float, duration_us: float, timestamp: int, object_id: int}>
- Get the raw flat tracing data
- isEmpty() : bool
- Check if the trace contains any data
- renderPerformanceSummary() : string
- Renders a simple performance summary
- renderPerformanceTree() : string
- Renders a text-based performance tree from the hierarchical data
- renderSelfCostSummary() : string
- Renders a performance summary focused on self costs
- calculateTotalDuration() : float
- Recursively calculates total duration from hierarchical data
- collectViewTimes() : array<string, array{time: float, count: int}>
- Collects view times from hierarchical tree
- countMethodCalls() : void
- Recursively counts method calls in hierarchical data
- countMethodCallsByType() : void
- Recursively counts method calls of a specific type in hierarchical data
- countViews() : void
- Recursively counts views in hierarchical data
- flattenTree() : void
- Flattens a tree structure into an array of all nodes
- flattenTreeToRawData() : void
- Flattens hierarchical tree to raw tracing data
- renderViewTreeNode() : string
- Renders a view tree node with proper tree-like indentation
- sortHierarchicalTree() : void
- Sorts hierarchical tree recursively
Constants
LINE_LENGTH
private
mixed
LINE_LENGTH
= 80
Properties
$renderCalls
The number of render method calls
public
int
$renderCalls
= 0
$sizeCalls
The number of getEstimatedSize method calls
public
int
$sizeCalls
= 0
$totalCalls
The total number of method calls
public
int
$totalCalls
= 0
$totalRenderTimeMs
The total render time in milliseconds of the full trace
public
float
$totalRenderTimeMs
= 0.0
$totalViews
The total number of unique views that were traced
public
int
$totalViews
= 0
$hierarchicalData
private
array<string|int, mixed>
$hierarchicalData
Methods
__construct()
Constructor
public
__construct(array<string, mixed> $hierarchicalData) : mixed
Parameters
- $hierarchicalData : array<string, mixed>
getHierarchicalData()
Get the hierarchical data
public
getHierarchicalData() : array<string, mixed>
Return values
array<string, mixed>getRawData()
Get the raw flat tracing data
public
getRawData() : array<string|int, array{method: string, class: string, proxy_class: string, duration_ns: int, duration_ms: float, duration_us: float, timestamp: int, object_id: int}>
Return values
array<string|int, array{method: string, class: string, proxy_class: string, duration_ns: int, duration_ms: float, duration_us: float, timestamp: int, object_id: int}>isEmpty()
Check if the trace contains any data
public
isEmpty() : bool
Return values
boolrenderPerformanceSummary()
Renders a simple performance summary
public
renderPerformanceSummary() : string
Return values
stringrenderPerformanceTree()
Renders a text-based performance tree from the hierarchical data
public
renderPerformanceTree([bool $showMethods = false ][, string $sortBy = 'timestamp' ]) : string
Parameters
- $showMethods : bool = false
-
Whether to show individual methods (render/getEstimatedSize) or aggregate by view
- $sortBy : string = 'timestamp'
-
Sort by 'duration' (total time), 'self_cost' (excluding children), or 'timestamp'
Return values
string —The formatted performance tree
renderSelfCostSummary()
Renders a performance summary focused on self costs
public
renderSelfCostSummary() : string
Return values
string —The formatted self cost summary
calculateTotalDuration()
Recursively calculates total duration from hierarchical data
private
calculateTotalDuration(array<string, mixed> $node) : float
Parameters
- $node : array<string, mixed>
Return values
floatcollectViewTimes()
Collects view times from hierarchical tree
private
collectViewTimes(array<string, mixed> $tree) : array<string, array{time: float, count: int}>
Parameters
- $tree : array<string, mixed>
Return values
array<string, array{time: float, count: int}>countMethodCalls()
Recursively counts method calls in hierarchical data
private
countMethodCalls(array<string, mixed> $node, int &$count) : void
Parameters
- $node : array<string, mixed>
- $count : int
countMethodCallsByType()
Recursively counts method calls of a specific type in hierarchical data
private
countMethodCallsByType(array<string, mixed> $node, string $methodType, int &$count) : void
Parameters
- $node : array<string, mixed>
- $methodType : string
- $count : int
countViews()
Recursively counts views in hierarchical data
private
countViews(array<string, mixed> $node, int &$count) : void
Parameters
- $node : array<string, mixed>
- $count : int
flattenTree()
Flattens a tree structure into an array of all nodes
private
flattenTree(array<string, mixed> $node, array<string|int, array<string, mixed>> &$result) : void
Parameters
- $node : array<string, mixed>
- $result : array<string|int, array<string, mixed>>
flattenTreeToRawData()
Flattens hierarchical tree to raw tracing data
private
flattenTreeToRawData(array<string, mixed> $node, array<string|int, array{method: string, class: string, proxy_class: string, duration_ns: int, duration_ms: float, duration_us: float, timestamp: int, object_id: int}> &$rawData) : void
Parameters
- $node : array<string, mixed>
- $rawData : array<string|int, array{method: string, class: string, proxy_class: string, duration_ns: int, duration_ms: float, duration_us: float, timestamp: int, object_id: int}>
renderViewTreeNode()
Renders a view tree node with proper tree-like indentation
private
renderViewTreeNode(array<string, mixed> $node, int $depth[, string $prefix = '' ][, bool $isLast = true ][, bool $showMethods = false ]) : string
Parameters
- $node : array<string, mixed>
- $depth : int
- $prefix : string = ''
- $isLast : bool = true
- $showMethods : bool = false
Return values
stringsortHierarchicalTree()
Sorts hierarchical tree recursively
private
sortHierarchicalTree(array<string, mixed> &$tree, string $sortBy, bool $showMethods) : void
Parameters
- $tree : array<string, mixed>
- $sortBy : string
- $showMethods : bool