Profiler
Utility class to assist in the process of benchmarking the execution of sections of code to understand where time is being spent.
since |
1.7.0 |
---|
Methods
__construct
Constructor
__construct(string $prefix = '')
since |
1.7.0 |
---|
Arguments
- $prefix
string
Prefix for mark messages
getBuffer
Get all profiler mark buffers.
getBuffer() : array
Returns an array of all mark buffers created since the Profiler object was instantiated. Marks are strings as per \Profiler::mark().
since |
1.7.0 |
---|
Response
array
Array of profiler marks
getInstance
Returns the global Profiler object, only creating it if it doesn't already exist.
getInstance(string $prefix = '') : \Joomla\CMS\Profiler\Profiler
since |
1.7.0 |
---|
Arguments
- $prefix
string
Prefix used to distinguish profiler objects.
Response
\Joomla\CMS\Profiler\Profiler
The Profiler object.
getMarks
Get all profiler marks.
getMarks() : array
Returns an array of all marks created since the Profiler object was instantiated. Marks are objects as per \JProfiler::mark().
since |
1.7.0 |
---|
Response
array
Array of profiler marks
getMemory
Get information about current memory usage.
getMemory() : integer
link |
PHP_MANUAL#memory_get_usage |
---|---|
since |
1.7.0 |
deprecated |
4.0 - Use PHP's native memory_get_usage() |
Response
integer
The memory usage
getmicrotime
Get the current time.
getmicrotime() : float
since |
1.7.0 |
---|---|
deprecated |
4.0 - Use PHP's microtime(1) |
Response
float
The current time
mark
Output a time mark
mark(string $label) : string
since |
1.7.0 |
---|
Arguments
- $label
string
A label for the time mark
Response
string
setStart
Sets the start time.
setStart(double $startTime = 0.0, integer $startMem) : $this
since |
3.0.0 |
---|
Arguments
- $startTime
double
Unix timestamp in microseconds for setting the Profiler start time.- $startMem
integer
Memory amount in bytes for setting the Profiler start memory.
Response
$this
For chaining
Properties
start
The start time.
since |
3.0.0 |
---|
Type(s)
integer
prefix
The prefix to use in the output
since |
3.0.0 |
---|
Type(s)
string
buffer
The buffer of profiling messages.
since |
3.0.0 |
---|
Type(s)
array
marks
The profiling messages.
since |
3.0.0 |
---|
Type(s)
array
previousTime
The previous time marker
since |
3.0.0 |
---|
Type(s)
float
previousMem
The previous memory marker
since |
3.0.0 |
---|
Type(s)
float
instances
JProfiler instances container.
since |
1.7.3 |
---|
Type(s)
array