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 |
|---|---|
| package |
Joomla CMS |
Methods
__construct
Constructor
__construct(string prefix = '') : mixed
| since |
1.7.0 |
|---|
Arguments
- prefix
stringPrefix for mark messages
Response
mixed
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 {@link Profiler::mark()}.
| since |
1.7.0 |
|---|
Response
arrayArray 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
stringPrefix used to distinguish profiler objects.
Response
\Joomla\CMS\Profiler\ProfilerThe 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 {@link JProfiler::mark()}.
| since |
1.7.0 |
|---|
Response
arrayArray of profiler marks
getMemory
Get information about current memory usage.
getMemory() : int
| link | |
|---|---|
| since |
1.7.0 |
| deprecated |
4.0 - Use PHP's native memory_get_usage() |
Response
intThe memory usage
getmicrotime
Get the current time.
getmicrotime() : float
| since |
1.7.0 |
|---|---|
| deprecated |
4.0 - Use PHP's microtime(1) |
Response
floatThe current time
mark
Output a time mark
mark(string label) : string
| since |
1.7.0 |
|---|
Arguments
- label
stringA label for the time mark
Response
string
setStart
Sets the start time.
setStart(float startTime = 0.0, int startMem) : $this
| since |
3.0.0 |
|---|
Arguments
- startTime
floatUnix timestamp in microseconds for setting the Profiler start time.- startMem
intMemory amount in bytes for setting the Profiler start memory.
Response
$thisFor chaining
Properties
start
The start time.
| since |
3.0.0 |
|---|
Type(s)
int
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