TeamSpeak 3 PHP Framework
1.1.12
|
Helper class providing profiler timers. More...
Public Member Functions | |
__construct ($name) | |
The TeamSpeak3_Helper_Profiler_Timer constructor. | |
start () | |
Starts the timer. | |
stop () | |
Stops the timer. | |
getRuntime () | |
Return the timer runtime. | |
getMemUsage ($realmem=FALSE) | |
Returns the amount of memory allocated to PHP in bytes. | |
isRunning () | |
Returns TRUE if the timer is running. | |
Protected Attributes | |
$running = FALSE | |
$started = 0 | |
$name = null | |
$data = array() |
The TeamSpeak3_Helper_Profiler_Timer constructor.
string | $name |
Definition at line 68 of file Timer.php.
References start().
{ $this->name = (string) $name; $this->data["runtime"] = 0; $this->data["realmem"] = 0; $this->data["emalloc"] = 0; $this->start(); }
Starts the timer.
Definition at line 84 of file Timer.php.
References isRunning().
Referenced by __construct(), getMemUsage(), and getRuntime().
{ if($this->isRunning()) return; $this->data["realmem_start"] = memory_get_usage(TRUE); $this->data["emalloc_start"] = memory_get_usage(); $this->started = microtime(TRUE); $this->running = TRUE; }
Stops the timer.
Definition at line 100 of file Timer.php.
References isRunning().
Referenced by getMemUsage(), and getRuntime().
{ if(!$this->isRunning()) return; $this->data["runtime"] += microtime(TRUE) - $this->started; $this->data["realmem"] += memory_get_usage(TRUE) - $this->data["realmem_start"]; $this->data["emalloc"] += memory_get_usage() - $this->data["emalloc_start"]; $this->started = 0; $this->running = FALSE; }
TeamSpeak3_Helper_Profiler_Timer::getMemUsage | ( | $ | realmem = FALSE | ) |
Returns the amount of memory allocated to PHP in bytes.
boolean | $realmem |
Definition at line 134 of file Timer.php.
References isRunning(), start(), and stop().
Returns TRUE if the timer is running.
Definition at line 150 of file Timer.php.
Referenced by getMemUsage(), getRuntime(), start(), and stop().
{
return $this->running;
}