/**
* Finishes profiling.
*
* @param string $type Request type
* @param string $method Method name
* @param array $params Method parameters
* @param mixed $response Server response
* @return \Jyxo\Rpc\Client
*/
protected function profileEnd($type, $method, array $params, $response)
{
// Profiling has to be turned on
if ($this->profiler) {
static $totalTime = 0;
static $requests = array();
// Get elapsed time
$time = \Jyxo\Timer::stop($this->timer);
$totalTime += $time;
$requests[] = array(strtoupper($type), (string) $method, $params, $response, sprintf('%0.3f', $time * 1000));
// Send to FirePHP
\Jyxo\FirePhp::table(sprintf('Jyxo RPC Profiler (%d requests took %0.3f ms)', count($requests), sprintf('%0.3f', $totalTime * 1000)), array('Type', 'Method', 'Request', 'Response', 'Time'), $requests, 'Rpc');
}
return $this;
}