MemoryHandler
extends AbstractHandler
in package
Debug memory handler class
Tags
Table of Contents
Properties
- $actualBytes : bool
- Actual bytes flag
- $limit : int
- Memory limit
- $logger : Logger|null
- Logger object
- $loggingParams : array<string|int, mixed>
- Logging params
- $name : string|null
- Name of time measurement
- $peaks : array<string|int, mixed>
- Peak memory usage snapshots
- $usages : array<string|int, mixed>
- Memory usage snapshots
Methods
- __construct() : mixed
- Constructor
- formatMemoryToInt() : int
- Format memory amount into integer
- formatMemoryToString() : string
- Format memory amount into readable string
- getLimit() : int
- Get memory limit
- getLogger() : Logger|null
- Get logger
- getLoggingParams() : array<string|int, mixed>
- Get logging params
- getName() : string|null
- Get name
- getPeakUsages() : array<string|int, mixed>
- Get peak memory usages snapshots
- getUsages() : array<string|int, mixed>
- Get memory usages snapshots
- hasLogger() : bool
- Has logger
- hasLoggingParams() : bool
- Has logging parameters
- hasName() : bool
- Has name
- hasPeakUsages() : bool
- Determine if the handler has peak memory usages snapshots
- hasUsages() : bool
- Determine if the handler has memory usages snapshots
- log() : void
- Trigger handler logging
- prepare() : array<string|int, mixed>
- Prepare handler data for storage
- prepareAsString() : string
- Prepare handler data as string
- prepareHeaderAsString() : string
- Prepare header string
- setLogger() : AbstractHandler
- Set logger
- setLoggingParams() : AbstractHandler
- Set logger
- setName() : AbstractHandler
- Set name
- updateMemoryUsage() : MemoryHandler
- Take a memory usage snapshot
- updatePeakMemoryUsage() : MemoryHandler
- Take a peak memory usage snapshot
- updateUsage() : MemoryHandler
- Take both a memory usage and peak usage snapshot
Properties
$actualBytes
Actual bytes flag
protected
bool
$actualBytes
= false
$limit
Memory limit
protected
int
$limit
= 0
$logger
Logger object
protected
Logger|null
$logger
= null
$loggingParams
Logging params
protected
array<string|int, mixed>
$loggingParams
= []
$name
Name of time measurement
protected
string|null
$name
= null
$peaks
Peak memory usage snapshots
protected
array<string|int, mixed>
$peaks
= []
$usages
Memory usage snapshots
protected
array<string|int, mixed>
$usages
= []
Methods
__construct()
Constructor
public
__construct([bool $actualBytes = false ][, string|null $name = null ][, Logger|null $logger = null ][, array<string|int, mixed> $loggingParams = [] ]) : mixed
Instantiate a memory handler object
Parameters
- $actualBytes : bool = false
- $name : string|null = null
- $logger : Logger|null = null
- $loggingParams : array<string|int, mixed> = []
formatMemoryToInt()
Format memory amount into integer
public
formatMemoryToInt(int|string $memory[, int $bytes = 1024 ]) : int
Parameters
- $memory : int|string
- $bytes : int = 1024
Return values
intformatMemoryToString()
Format memory amount into readable string
public
formatMemoryToString(int|string $memory[, int $bytes = 1024 ]) : string
Parameters
- $memory : int|string
- $bytes : int = 1024
Return values
stringgetLimit()
Get memory limit
public
getLimit() : int
Return values
intgetLogger()
Get logger
public
getLogger() : Logger|null
Return values
Logger|nullgetLoggingParams()
Get logging params
public
getLoggingParams() : array<string|int, mixed>
Return values
array<string|int, mixed>getName()
Get name
public
getName() : string|null
Return values
string|nullgetPeakUsages()
Get peak memory usages snapshots
public
getPeakUsages() : array<string|int, mixed>
Return values
array<string|int, mixed>getUsages()
Get memory usages snapshots
public
getUsages() : array<string|int, mixed>
Return values
array<string|int, mixed>hasLogger()
Has logger
public
hasLogger() : bool
Return values
boolhasLoggingParams()
Has logging parameters
public
hasLoggingParams() : bool
Return values
boolhasName()
Has name
public
hasName() : bool
Return values
boolhasPeakUsages()
Determine if the handler has peak memory usages snapshots
public
hasPeakUsages() : bool
Return values
boolhasUsages()
Determine if the handler has memory usages snapshots
public
hasUsages() : bool
Return values
boollog()
Trigger handler logging
public
log() : void
Tags
prepare()
Prepare handler data for storage
public
prepare() : array<string|int, mixed>
Return values
array<string|int, mixed>prepareAsString()
Prepare handler data as string
public
prepareAsString() : string
Return values
stringprepareHeaderAsString()
Prepare header string
public
prepareHeaderAsString() : string
Return values
stringsetLogger()
Set logger
public
setLogger(Logger $logger) : AbstractHandler
Parameters
- $logger : Logger
Return values
AbstractHandlersetLoggingParams()
Set logger
public
setLoggingParams(array<string|int, mixed> $loggingParams) : AbstractHandler
Parameters
- $loggingParams : array<string|int, mixed>
Return values
AbstractHandlersetName()
Set name
public
setName(string $name) : AbstractHandler
Parameters
- $name : string
Return values
AbstractHandlerupdateMemoryUsage()
Take a memory usage snapshot
public
updateMemoryUsage([bool $real = false ]) : MemoryHandler
Parameters
- $real : bool = false
Return values
MemoryHandlerupdatePeakMemoryUsage()
Take a peak memory usage snapshot
public
updatePeakMemoryUsage([bool $real = false ]) : MemoryHandler
Parameters
- $real : bool = false
Return values
MemoryHandlerupdateUsage()
Take both a memory usage and peak usage snapshot
public
updateUsage([bool $real = false ]) : MemoryHandler
Parameters
- $real : bool = false