Reworked profiler
This commit is contained in:
46
util/profiler/CommandProfiler.php
Normal file
46
util/profiler/CommandProfiler.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright NetMonsters <team@netmonsters.ru>
|
||||
* @link http://netmonsters.ru
|
||||
* @package Majestic
|
||||
* @subpackage util
|
||||
* @since 2010-03-09
|
||||
* @version SVN: $Id$
|
||||
* @filesource $URL$
|
||||
*/
|
||||
|
||||
class CommandProfiler
|
||||
{
|
||||
|
||||
protected $type;
|
||||
protected $command = '';
|
||||
protected $start = null;
|
||||
protected $end = null;
|
||||
|
||||
public function __construct($type, $command)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->command = $command;
|
||||
$this->start = microtime(true);
|
||||
}
|
||||
|
||||
public function end()
|
||||
{
|
||||
$this->end = microtime(true);
|
||||
}
|
||||
|
||||
public function getCommand()
|
||||
{
|
||||
return $this->command;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function getElapsed()
|
||||
{
|
||||
return $this->end - $this->start;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user