Class: Timer
Source Location: /blogs/inc/_misc/_timer.class.php
Class Timer
Class Overview
|
This is a simple class to allow timing/profiling of code portions. Located in /blogs/inc/_misc/_timer.class.php [line 39] |
[ Top ]
Method Summary
| Timer | Timer() | Constructor. |
| array | get_categories() | Get a list of used categories. |
| integer | get_count() | Get number of timer resumes (includes start). |
| float | get_current_microtime() | Get the current time in microseconds. |
| string | get_duration() | Get the duration for a given category. |
| float | get_microtime() | Get the time in microseconds that was spent in the given category. |
| string | get_state() | Get the state a category timer is in. |
| boolean | pause() | Pauses a timer category. It may me resumed later on, see resume(). |
| void | reset() | Reset a timer category. |
| void | resume() | Resumes the timer on a category. |
| void | start() | Start a timer. |
| boolean | stop() | Stops a timer category. It may me resumed later on, see resume(). This is an alias for pause(). |
[ Top ]
Properties
Methods
Constructor Timer [line 56]
|
Constructor.
Parameters:| string|NULL | $category: | If a category is given the timer starts right away. |
[ Top ]
get_count [line 165]
|
Get number of timer resumes (includes start).
Parameters:| $category: |
[ Top ]
get_current_microtime [line 236]
|
Get the current time in microseconds.
[ Top ]
get_duration [line 154]
|
Get the duration for a given category.
Parameters:| string | $category: | Category name |
| integer | $decimals: | Number of decimals after dot. |
[ Top ]
get_microtime [line 181]
|
Get the time in microseconds that was spent in the given category.
Parameters:| $category: |
[ Top ]
get_state [line 204]
|
Get the state a category timer is in.
Parameters:| $category: |
API Tags:
| Return: | 'unknown', 'not initialised', 'running', 'paused' |
[ Top ]
pause [line 114]
|
Pauses a timer category. It may me resumed later on, see resume().
NOTE: The timer needs to be started, either through the Constructor or the start() method.
Parameters:| $category: |
API Tags:
| Return: | false, if the timer had not been started. |
[ Top ]
resume [line 131]
|
Resumes the timer on a category.
Parameters:| $category: |
[ Top ]
start [line 77]
|
Start a timer.
Parameters:| $category: | ||
| $log: |
[ Top ]
