PerformanceMeasurement Class Reference

Public Member Functions

 startClock ()
 endClockAndGet ()
 addTimingById ($identifer, $time)
 getTimings ()
 setRedBeanQueryLogger (ZurmoRedBeanPluginQueryLogger $redBeanQueryLogger)
 getRedBeanQueryLogger ()
 startMemoryUsageMarker ()
 getMemoryMarkerUsage ()
 getMemoryUsage ($realUsage=false)
 getAllocatedMemoryInBytes ()
 getMemoryUsageRatio ()
 isMemoryUsageSafe ()

Data Fields

const MAX_MEMORY_USAGE_RATIO = 0.8

Protected Member Functions

 convertToBytes ($value)

Protected Attributes

 $startTime
 $memoryUsage
 $timings = array()
 $redBeanQueryLogger

Detailed Description

Definition at line 37 of file PerformanceMeasurement.php.


Member Function Documentation

addTimingById ( identifer,
time 
)

Given a time in seconds and an indentifier, add the time to the existing timings array data. This will add to the existing value.

Parameters:
string $identifer
number $time

Definition at line 75 of file PerformanceMeasurement.php.

getTimings (  ) 
Returns:
array of timings data.

Definition at line 90 of file PerformanceMeasurement.php.

setRedBeanQueryLogger ( ZurmoRedBeanPluginQueryLogger redBeanQueryLogger  ) 

Set the query logger during the RedBeanDatabase setup. This can then be used after the page is rendered to gather information about query counts, duplicate queries, and other query information.

Parameters:
Zurmo_RedBean_Plugin_QueryLogger $queryLogger

Definition at line 100 of file PerformanceMeasurement.php.

startMemoryUsageMarker (  ) 

Start a capture of how much memory is being used.

Definition at line 113 of file PerformanceMeasurement.php.

getMemoryMarkerUsage (  ) 
Returns:
integer - the difference in memory used at the start part until now. This is the differential amount.

Definition at line 121 of file PerformanceMeasurement.php.

getMemoryUsage ( realUsage = false  ) 
Parameters:
bool $realUsage
Returns:
int - Memory usage

Definition at line 130 of file PerformanceMeasurement.php.

getAllocatedMemoryInBytes (  ) 

Get memory allocated for PHP scripts in bytes

Definition at line 138 of file PerformanceMeasurement.php.

getMemoryUsageRatio (  ) 

Get ration between used and allocated memory

Returns:
float|int

Definition at line 149 of file PerformanceMeasurement.php.

isMemoryUsageSafe (  ) 

Check if memory usage is safe

Returns:
bool

Definition at line 171 of file PerformanceMeasurement.php.

convertToBytes ( value  )  [protected]

Convert kilobytes, megabytes, and gigabytes into bytes input value is in format $value{size} where size is in {'K','M','G'}

Parameters:
$value 
Returns:
int

Definition at line 190 of file PerformanceMeasurement.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Thu Oct 19 07:10:28 2017