phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Class: Timer

Source Location: /qp_inc/_core/model/_timer.class.php

Class Timer

Property Summary
mixed   $_times   Remember times.

[ 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
mixed   $_times = array() [line 49]

Remember times.

We store for each category (primary key) the state, start/resume time and the total passed time.

API Tags:
Access:  protected


[ Top ]
Methods
Constructor Timer  [line 57]

  Timer Timer( [string|NULL $category = NULL]  )

Constructor.

Parameters:
string|NULL   $category:  If a category is given the timer starts right away.


[ Top ]
get_categories  [line 226]

  array get_categories( )

Get a list of used categories.



[ Top ]
get_count  [line 166]

  integer get_count( $category  )

Get number of timer resumes (includes start).

Parameters:
   $category: 


[ Top ]
get_current_microtime  [line 237]

  float get_current_microtime( )

Get the current time in microseconds.



[ Top ]
get_duration  [line 155]

  string get_duration( string $category, [integer $decimals = 3]  )

Get the duration for a given category.

Parameters:
string   $category:  Category name
integer   $decimals:  Number of decimals after dot.


[ Top ]
get_microtime  [line 182]

  float get_microtime( $category  )

Get the time in microseconds that was spent in the given category.

Parameters:
   $category: 


[ Top ]
get_state  [line 205]

  string get_state( $category  )

Get the state a category timer is in.

Parameters:
   $category: 

API Tags:
Return:  'unknown', 'not initialised', 'running', 'paused'


[ Top ]
pause  [line 115]

  boolean pause( $category  )

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 ]
reset  [line 69]

  void reset( $category  )

Reset a timer category.

Parameters:
   $category: 


[ Top ]
resume  [line 132]

  void resume( $category  )

Resumes the timer on a category.

Parameters:
   $category: 


[ Top ]
start  [line 78]

  void start( $category, [ $log = true]  )

Start a timer.

Parameters:
   $category: 
   $log: 


[ Top ]
stop  [line 92]

  boolean stop( $category  )

Stops a timer category. It may me resumed later on, see resume(). This is an alias for pause().

Parameters:
   $category: 

API Tags:
Return:  false, if the timer had not been started.


[ Top ]