Profiler
Implements ProfilerInterface, IteratorAggregate, CountableImplementation of ProfilerInterface.
| since |
1.0 |
|---|---|
| package |
Joomla Framework |
Methods
__construct
Constructor.
__construct( name, \Joomla\Profiler\ProfilerRendererInterface renderer = null, \Joomla\Profiler\ProfilePointInterface||string|int points = [], memoryRealUsage = false) :
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- name
stringThe profiler name.- renderer
ProfilerRendererInterface|nullThe renderer.- points
array<string|int, ProfilePointInterface>An array of profile points.- memoryRealUsage
boolTrue to get the real memory usage.
Response
mixed
__toString
Cast the profiler to a string using the renderer.
__toString() :
| since |
1.0 |
|---|
Response
stringThe rendered profiler.
count
Count the number of points in this profiler.
count() :
| since |
1.0 |
|---|
Response
intThe number of points.
getIterator
Get an iterator on the profiler points.
getIterator() : \ArrayIterator
| since |
1.0 |
|---|
Response
ArrayIteratorAn iterator on the profiler points.
getMemoryBytesBetween
Get the amount of allocated memory in bytes between the two points.
getMemoryBytesBetween( first, second) :
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- first
stringThe name of the first point.- second
stringThe name of the second point.
Response
intThe amount of allocated memory between these points in bytes.
getMemoryPeakBytes
Get the memory peak in bytes during the profiler run.
getMemoryPeakBytes() :
| since |
1.0 |
|---|
Response
intThe memory peak in bytes.
getName
Get the name of this profiler.
getName() :
| since |
1.0 |
|---|
Response
stringThe name of this profiler.
getPoint
Get the point identified by the given name.
getPoint( name, default = null) : \Joomla\Profiler\ProfilePointInterface|mixed
| since |
1.0 |
|---|
Arguments
- name
stringThe name of the point.- default
mixedThe default value if the point hasn't been marked.
Response
ProfilePointInterface|mixedThe profile point or the default value.
getPoints
Get the points in this profiler (from the first to the last).
getPoints() : \Joomla\Profiler\ProfilePointInterface||string|int
getRenderer
Get the currently used renderer in this profiler.
getRenderer() : \Joomla\Profiler\ProfilerRendererInterface
getTimeBetween
Get the elapsed time in seconds between the two points.
getTimeBetween( first, second) :
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- first
stringThe name of the first point.- second
stringThe name of the second point.
Response
floatThe elapsed time between these points in seconds.
hasPoint
Check if the profiler has marked the given point.
hasPoint( name) :
| since |
1.0 |
|---|
Arguments
- name
stringThe name of the point.
Response
boolTrue if the profiler has marked the point, false otherwise.
mark
Mark a profile point.
mark( name) : \Joomla\Profiler\ProfilerInterface
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- name
stringThe profile point name.
Response
ProfilerInterfaceThis method is chainable.
render
Render the profiler.
render() :
| since |
1.0 |
|---|
Response
stringThe rendered profiler.
setPoints
Set the points in this profiler.
setPoints(\Joomla\Profiler\ProfilePointInterface||string|int points) :
This function is called by the constructor when injecting an array of points (mostly for testing purposes).
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- points
array<string|int, ProfilePointInterface>An array of profile points.
Response
void
setRenderer
Set the renderer to render this profiler.
setRenderer(\Joomla\Profiler\ProfilerRendererInterface renderer) : \Joomla\Profiler\Profiler
| since |
1.0 |
|---|
Arguments
- renderer
ProfilerRendererInterfaceThe renderer.
Response
ProfilerThis method is chainable.
setStart
Creates a profile point with the specified starting time and memory.
setStart( timeStamp = 0.0, memoryBytes) : \Joomla\Profiler\ProfilerInterface
This method will only add a point if no other points have been added as the ProfilePointInterface objects created before changing the start point would result in inaccurate measurements.
| since |
1.2.0 |
|---|---|
| throws |
|
Arguments
- timeStamp
floatUnix timestamp in microseconds when the profiler should start measuring time.- memoryBytes
intMemory amount in bytes when the profiler should start measuring memory.
Response
ProfilerInterfaceThis method is chainable.
Properties
name
The name of the profiler.
| since |
1.0 |
|---|
Type(s)
string
points
An array of profiler points (from the first to last).
lookup
A lookup array containing the names of the already marked points as keys * and their indexes in $points as value.
It is used to quickly find a point without having to traverse $points.
| since |
1.0 |
|---|
Type(s)
array<string|int, mixed>
memoryRealUsage
A flag to see if we must get the real memory usage, or the usage of emalloc().
| since |
1.0 |
|---|
Type(s)
bool
startTimeStamp
The timestamp with microseconds when the first point was marked.
| since |
1.0 |
|---|
Type(s)
float
startMemoryBytes
The memory usage in bytes when the first point was marked.
| since |
1.0 |
|---|
Type(s)
int
memoryPeakBytes
The memory peak in bytes during the profiler run.
| since |
1.0 |
|---|
Type(s)
int