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( prefix = '') : 
since

1.7.0

Arguments

prefix

stringPrefix for mark messages

Response

mixed

getBuffer

Get all profiler mark buffers.

getBuffer() : mixed||string|int

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

array<string|int, mixed>Array of profiler marks

getInstance

Returns the global Profiler object, only creating it if it doesn't already exist.

getInstance( prefix = '') : \Joomla\CMS\Profiler\Profiler
static
since

1.7.0

Arguments

prefix

stringPrefix used to distinguish profiler objects.

Response

ProfilerThe Profiler object.

getMarks

Get all profiler marks.

getMarks() : mixed||string|int

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

array<string|int, mixed>Array of profiler marks

mark

Output a time mark

mark( label) : 
since

1.7.0

Arguments

label

stringA label for the time mark

Response

string

setStart

Sets the start time.

setStart( startTime = 0.0,  startMem) : 
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<string|int, mixed>

marks

The profiling messages.

since

3.0.0

Type(s)

array<string|int, mixed>

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<string|int, mixed>