class Profiler implements ProfilerInterface, Countable (View source)

Class Profiler

Methods

__construct(string $name, ProfilerRendererInterface $renderer = null, array $points = array(), boolean $memoryRealUsage = null)

Constructor.

setPoint(PointInterface $point)

set Point

string
getName()

Get the name of this profiler.

mark(string $name, array|CollectorInterface $data = array())

Mark a profile point.

boolean
hasPoint(string $name)

Check if the profiler has marked the given point.

ProfilerPointInterface
getPoint(string $name)

Get the point identified by the given name.

float
getTimeBetween(string $first, string $second)

Get the elapsed time in seconds between the two points.

integer
getMemoryBetween(string $first, string $second)

Get the amount of allocated memory in bytes between the two points.

integer
getMemoryPeakBytes()

Get the memory peak in bytes during the profiler run.

boolean
getMemoryRealUsage()

Method to get property MemoryRealUsage

ProfilerPointInterface[]
getPoints()

Get the points in this profiler (from the first to the last).

setRenderer(ProfilerRendererInterface $renderer)

Set the renderer to render this profiler.

getRenderer()

Get the currently used renderer in this profiler.

string
render()

Render the profiler.

string
__toString()

Cast the profiler to a string using the renderer.

getIterator()

Get an iterator on the profiler points.

integer
count()

Count the number of points in this profiler.

useMemoryRealUsage(boolean $memoryRealUsage)

Method to set property memoryRealUsage

Details

at line line 91
__construct(string $name, ProfilerRendererInterface $renderer = null, array $points = array(), boolean $memoryRealUsage = null)

Constructor.

Parameters

string $name The profiler name.
ProfilerRendererInterface $renderer The renderer.
array $points An array of profile points.
boolean $memoryRealUsage True to get the real memory usage.

Exceptions

InvalidArgumentException

at line line 119
Profiler setPoint(PointInterface $point)

set Point

Parameters

PointInterface $point

Return Value

Profiler

Exceptions

InvalidArgumentException

at line line 162
string getName()

Get the name of this profiler.

Return Value

string The name of this profiler.

at line line 177
ProfilerInterface mark(string $name, array|CollectorInterface $data = array())

Mark a profile point.

Parameters

string $name The profile point name.
array|CollectorInterface $data The data collection of this point.

Return Value

ProfilerInterface This method is chainable.

Exceptions

InvalidArgumentException If the point already exists.

at line line 226
boolean hasPoint(string $name)

Check if the profiler has marked the given point.

Parameters

string $name The name of the point.

Return Value

boolean True if the profiler has marked the point, false otherwise.

at line line 238
ProfilerPointInterface getPoint(string $name)

Get the point identified by the given name.

Parameters

string $name The name of the point.

Return Value

ProfilerPointInterface The profile point or the default value.

at line line 258
float getTimeBetween(string $first, string $second)

Get the elapsed time in seconds between the two points.

Parameters

string $first The name of the first point.
string $second The name of the second point.

Return Value

float The elapsed time between these points in seconds.

Exceptions

LogicException If the points were not marked.

at line line 286
integer getMemoryBetween(string $first, string $second)

Get the amount of allocated memory in bytes between the two points.

Parameters

string $first The name of the first point.
string $second The name of the second point.

Return Value

integer The amount of allocated memory between these points in bytes.

Exceptions

LogicException If the points were not marked.

at line line 309
integer getMemoryPeakBytes()

Get the memory peak in bytes during the profiler run.

Return Value

integer The memory peak in bytes.

at line line 319
boolean getMemoryRealUsage()

Method to get property MemoryRealUsage

Return Value

boolean

at line line 329
ProfilerPointInterface[] getPoints()

Get the points in this profiler (from the first to the last).

Return Value

ProfilerPointInterface[] An array of points in this profiler.

at line line 341
Profiler setRenderer(ProfilerRendererInterface $renderer)

Set the renderer to render this profiler.

Parameters

ProfilerRendererInterface $renderer The renderer.

Return Value

Profiler This method is chainable.

at line line 353
ProfilerRendererInterface getRenderer()

Get the currently used renderer in this profiler.

Return Value

ProfilerRendererInterface The renderer.

at line line 363
string render()

Render the profiler.

Return Value

string The rendered profiler.

at line line 373
string __toString()

Cast the profiler to a string using the renderer.

Return Value

string The rendered profiler.

at line line 383
ArrayIterator getIterator()

Get an iterator on the profiler points.

Return Value

ArrayIterator An iterator on the profiler points.

at line line 393
integer count()

Count the number of points in this profiler.

Return Value

integer The number of points.

at line line 405
Profiler useMemoryRealUsage(boolean $memoryRealUsage)

Method to set property memoryRealUsage

Parameters

boolean $memoryRealUsage

Return Value

Profiler Return self to support chaining.