MemoryPeakUsageProcessor
extends MemoryProcessor
in package
Injects memory_get_peak_usage in all records
Tags
Table of Contents
- $realUsage : bool
- $useFormatting : bool
- __construct() : mixed
- __invoke() : array<string|int, mixed>
- {@inheritDoc}
- formatBytes() : string|int
- Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is
Properties
$realUsage
protected
bool
$realUsage
If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported.
$useFormatting
protected
bool
$useFormatting
If true, then format memory size to human readable string (MB, KB, B depending on size)
Methods
__construct()
public
__construct([bool $realUsage = true ][, bool $useFormatting = true ]) : mixed
Parameters
- $realUsage : bool = true
-
Set this to true to get the real size of memory allocated from system.
- $useFormatting : bool = true
-
If true, then format memory size to human readable string (MB, KB, B depending on size)
Return values
mixed —__invoke()
{@inheritDoc}
public
__invoke(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
Return values
array<string|int, mixed> —formatBytes()
Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is
protected
formatBytes(int $bytes) : string|int
Parameters
- $bytes : int
Return values
string|int —Formatted string if $this->useFormatting is true, otherwise return $bytes as int