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

stringPrefix 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

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
static
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 \JProfiler::mark().

since

1.7.0

Response

arrayArray of profiler marks

getMemory

Get information about current memory usage.

getMemory() : integer
deprecated
link

PHP_MANUAL#memory_get_usage

since

1.7.0

deprecated

4.0 - Use PHP's native memory_get_usage()

Response

integerThe memory usage

getmicrotime

Get the current time.

getmicrotime() : float
static deprecated
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(double $startTime = 0.0, integer $startMem) : $this
since

3.0.0

Arguments

$startTime

doubleUnix timestamp in microseconds for setting the Profiler start time.

$startMem

integerMemory amount in bytes for setting the Profiler start memory.

Response

$thisFor 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.

static
since

1.7.3

Type(s)

array