Propel 2 API
Class

Propel\Runtime\Util\Profiler

class Profiler

Profiler for Propel

Methods

__construct($slowTreshold = 0.1, $innerGlue = ': ', $outerGlue = ' | ')

setSlowTreshold(integer $slowTreshold)

Set the duration which triggers the 'slow' label on details.

setDetails(array $details)

Set the list of details to be included in a profile.

setInnerGlue(string $innerGlue)

Set the inner glue for the details.

setOuterGlue(string $outerGlue)

Set the outer glue for the details.

setConfiguration(array $profilerConfiguration)

Configure the profiler from an array.

array getConfiguration()

Get an array representing the configuration of the profiler.

start()

isSlow()

getProfile()

string getProfileBetween(array $startSnapshot, array $endSnapshot)

Returns a string that may be prepended to a log line, containing debug information according to the current configuration.

static array getSnapshot()

Get a snapshot of the current time and memory consumption.

static string formatMemory(integer $bytes, integer $precision = 3)

Format a byte count into a human-readable representation.

static string formatDuration(double $duration, integer $precision = 3)

Format a duration into a human-readable representation.

static float toPrecision(float $number, integer $significantFigures = 3)

Rounding to significant digits (sort of like JavaScript's toPrecision()).

Details

at line 39
public __construct($slowTreshold = 0.1, $innerGlue = ': ', $outerGlue = ' | ')

Parameters

$slowTreshold
$innerGlue
$outerGlue

at line 51
public setSlowTreshold(integer $slowTreshold)

Set the duration which triggers the 'slow' label on details.

Parameters

integer $slowTreshold duration in seconds

at line 61
public setDetails(array $details)

Set the list of details to be included in a profile.

Parameters

array $details

at line 71
public setInnerGlue(string $innerGlue)

Set the inner glue for the details.

Parameters

string $innerGlue

at line 81
public setOuterGlue(string $outerGlue)

Set the outer glue for the details.

Parameters

string $outerGlue

at line 112
public setConfiguration(array $profilerConfiguration)

Configure the profiler from an array.

Parameters

array $profilerConfiguration

at line 135
public array getConfiguration()

Get an array representing the configuration of the profiler.

This array can be used as an input for self::setConfiguration().

Return Value

array

at line 145
public start()

at line 150
public isSlow()

at line 155
public getProfile()

at line 174
public string getProfileBetween(array $startSnapshot, array $endSnapshot)

Returns a string that may be prepended to a log line, containing debug information according to the current configuration.

Uses two debug snapshots to calculate how much time has passed since the call to
self::start(), how much the memory consumption by PHP has changed etc.

Parameters

array $startSnapshot A snapshot, as returned by self::getSnapshot().
array $endSnapshot A snapshot, as returned by self::getSnapshot().

Return Value

string

See also

self::getSnapshot()

at line 218
static public array getSnapshot()

Get a snapshot of the current time and memory consumption.

Return Value

array

at line 235
static public string formatMemory(integer $bytes, integer $precision = 3)

Format a byte count into a human-readable representation.

Parameters

integer $bytes Byte count to convert. Can be negative.
integer $precision How many decimals to include.

Return Value

string

at line 257
static public string formatDuration(double $duration, integer $precision = 3)

Format a duration into a human-readable representation.

Parameters

double $duration Duration to format, in seconds.
integer $precision How many decimals to include.

Return Value

string

at line 278
static public float toPrecision(float $number, integer $significantFigures = 3)

Rounding to significant digits (sort of like JavaScript's toPrecision()).

Parameters

float $number Value to round
integer $significantFigures Number of significant figures

Return Value

float