@@ -6,18 +6,18 @@ |
||
| 6 | 6 | class PhpQuickProfilerTest extends PHPUnit_Framework_TestCase |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - public function __construct() |
|
| 10 | - { |
|
| 11 | - } |
|
| 9 | + public function __construct() |
|
| 10 | + { |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function testConstruct() |
|
| 14 | - { |
|
| 15 | - $console = new Console(); |
|
| 16 | - $startTime = microtime(true); |
|
| 13 | + public function testConstruct() |
|
| 14 | + { |
|
| 15 | + $console = new Console(); |
|
| 16 | + $startTime = microtime(true); |
|
| 17 | 17 | |
| 18 | - $profiler = new PhpQuickProfiler($console, $startTime); |
|
| 18 | + $profiler = new PhpQuickProfiler($console, $startTime); |
|
| 19 | 19 | |
| 20 | - $this->assertAttributeSame($console, 'console', $profiler); |
|
| 21 | - $this->assertAttributeEquals($startTime, 'startTime', $profiler); |
|
| 22 | - } |
|
| 20 | + $this->assertAttributeSame($console, 'console', $profiler); |
|
| 21 | + $this->assertAttributeEquals($startTime, 'startTime', $profiler); |
|
| 22 | + } |
|
| 23 | 23 | } |
@@ -14,183 +14,183 @@ |
||
| 14 | 14 | class Display |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** @var array */ |
|
| 18 | - protected $output; |
|
| 19 | - |
|
| 20 | - public function __construct() |
|
| 21 | - { |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - public function setConsole(Console $console) |
|
| 25 | - { |
|
| 26 | - $console_data = array( |
|
| 27 | - 'messages' => array(), |
|
| 28 | - 'count' => array( |
|
| 29 | - 'log' => 0, |
|
| 30 | - 'memory' => 0, |
|
| 31 | - 'error' => 0, |
|
| 32 | - 'speed' => 0 |
|
| 33 | - ) |
|
| 34 | - ); |
|
| 35 | - foreach ($console->getLogs() as $log) { |
|
| 36 | - switch($log['type']) { |
|
| 37 | - case 'log': |
|
| 38 | - $message = array( |
|
| 39 | - 'data' => print_r($log['data'], true), |
|
| 40 | - 'type' => 'log' |
|
| 41 | - ); |
|
| 42 | - $console_data['count']['log']++; |
|
| 43 | - break; |
|
| 44 | - case 'memory': |
|
| 45 | - $message = array( |
|
| 46 | - 'name' => $log['name'], |
|
| 47 | - 'data' => self::getReadableMemory($log['data']), |
|
| 48 | - 'type' => 'memory' |
|
| 49 | - ); |
|
| 50 | - if (!empty($log['data_type'])) { |
|
| 51 | - $message['data_type'] = $log['data_type']; |
|
| 52 | - } |
|
| 53 | - $console_data['count']['memory']++; |
|
| 54 | - break; |
|
| 55 | - case 'error': |
|
| 56 | - $message = array( |
|
| 57 | - 'data' => $log['data'], |
|
| 58 | - 'file' => $log['file'], |
|
| 59 | - 'line' => $log['line'], |
|
| 60 | - 'type' => 'error' |
|
| 61 | - ); |
|
| 62 | - $console_data['count']['error']++; |
|
| 63 | - break; |
|
| 64 | - case 'speed': |
|
| 65 | - $elapsedTime = $log['data'] - $this->startTime; |
|
| 66 | - $message = array( |
|
| 67 | - 'name' => $log['name'], |
|
| 68 | - 'data' => self::getReadableTime($elapsedTime), |
|
| 69 | - 'type' => 'speed' |
|
| 70 | - ); |
|
| 71 | - $console_data['count']['speed']++; |
|
| 72 | - break; |
|
| 73 | - default: |
|
| 74 | - $message = array( |
|
| 75 | - 'data' => "Unrecognized console log type: {$log['type']}", |
|
| 76 | - 'type' => 'error' |
|
| 77 | - ); |
|
| 78 | - $console_data['count']['error']++; |
|
| 79 | - break; |
|
| 80 | - } |
|
| 81 | - array_push($console_data['messages'], $message); |
|
| 82 | - } |
|
| 83 | - $this->output['console'] = $console_data; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * Sets file data |
|
| 88 | - * |
|
| 89 | - * @param array $data |
|
| 90 | - */ |
|
| 91 | - public function setFileData(array $data) |
|
| 92 | - { |
|
| 93 | - $fileData = array( |
|
| 94 | - 'fileList' => array(), |
|
| 95 | - 'fileTotals' => array( |
|
| 96 | - 'count' => count($data), |
|
| 97 | - 'size' => 0, |
|
| 98 | - 'largest' => 0 |
|
| 99 | - ) |
|
| 100 | - ); |
|
| 101 | - |
|
| 102 | - foreach ($data as $file) { |
|
| 103 | - array_push($fileData['fileList'], array( |
|
| 104 | - 'name' => $file['name'], |
|
| 105 | - 'size' => self::getReadableMemory($file['size']) |
|
| 106 | - )); |
|
| 107 | - |
|
| 108 | - $fileData['fileTotals']['size'] += $file['size']; |
|
| 109 | - if ($file['size'] > $fileData['fileTotals']['largest']) { |
|
| 110 | - $fileData['fileTotals']['largest'] = $file['size']; |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - $fileData['fileTotals']['size'] = self::getReadableMemory($fileData['fileTotals']['size']); |
|
| 115 | - $fileData['fileTotals']['largest'] = self::getReadableMemory($fileData['fileTotals']['largest']); |
|
| 116 | - |
|
| 117 | - $this->output['files'] = $fileData['fileList']; |
|
| 118 | - $this->output['fileTotals'] = $fileData['fileTotals']; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Sets memory data |
|
| 123 | - * |
|
| 124 | - * @param array $data |
|
| 125 | - */ |
|
| 126 | - public function setMemoryData(array $data) |
|
| 127 | - { |
|
| 128 | - $this->output['memory'] = array( |
|
| 129 | - 'used' => self::getReadableMemory($data['used']), |
|
| 130 | - 'allowed' => $data['allowed'] |
|
| 131 | - ); |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - public function setQueryData(array $query_data) |
|
| 135 | - { |
|
| 136 | - // the void |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * Sets speed data |
|
| 141 | - * |
|
| 142 | - * @param array $data |
|
| 143 | - */ |
|
| 144 | - public function setSpeedData(array $data) |
|
| 145 | - { |
|
| 146 | - $this->output['speed'] = array( |
|
| 147 | - 'elapsed' => self::getReadableTime($data['elapsed']), |
|
| 148 | - 'allowed' => self::getReadableTime($data['allowed'], 0) |
|
| 149 | - ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Static formatter for human-readable time |
|
| 154 | - * Only handles time up to 60 minutes gracefully |
|
| 155 | - * |
|
| 156 | - * @param double $time |
|
| 157 | - * @param integer $decimals |
|
| 158 | - * @return string |
|
| 159 | - */ |
|
| 160 | - public static function getReadableTime($time, $decimals = 3) |
|
| 161 | - { |
|
| 162 | - $unit = 's'; |
|
| 163 | - if ($time < 1) { |
|
| 164 | - $time *= 1000; |
|
| 165 | - $unit = 'ms'; |
|
| 166 | - } else if ($time > 60) { |
|
| 167 | - $time /= 60; |
|
| 168 | - $unit = 'm'; |
|
| 169 | - } |
|
| 170 | - $time = number_format($time, $decimals); |
|
| 171 | - return "{$time} {$unit}"; |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Static formatter for human-readable memory |
|
| 176 | - * |
|
| 177 | - * @param double $size |
|
| 178 | - * @param integer $decimals |
|
| 179 | - */ |
|
| 180 | - public static function getReadableMemory($size, $decimals = 2) |
|
| 181 | - { |
|
| 182 | - $unitOptions = array('b', 'k', 'M', 'G'); |
|
| 183 | - |
|
| 184 | - $base = log($size, 1024); |
|
| 185 | - |
|
| 186 | - $memory = round(pow(1024, $base - floor($base)), $decimals); |
|
| 187 | - $unit = $unitOptions[floor($base)]; |
|
| 188 | - return "{$memory} {$unit}"; |
|
| 189 | - } |
|
| 17 | + /** @var array */ |
|
| 18 | + protected $output; |
|
| 19 | + |
|
| 20 | + public function __construct() |
|
| 21 | + { |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + public function setConsole(Console $console) |
|
| 25 | + { |
|
| 26 | + $console_data = array( |
|
| 27 | + 'messages' => array(), |
|
| 28 | + 'count' => array( |
|
| 29 | + 'log' => 0, |
|
| 30 | + 'memory' => 0, |
|
| 31 | + 'error' => 0, |
|
| 32 | + 'speed' => 0 |
|
| 33 | + ) |
|
| 34 | + ); |
|
| 35 | + foreach ($console->getLogs() as $log) { |
|
| 36 | + switch($log['type']) { |
|
| 37 | + case 'log': |
|
| 38 | + $message = array( |
|
| 39 | + 'data' => print_r($log['data'], true), |
|
| 40 | + 'type' => 'log' |
|
| 41 | + ); |
|
| 42 | + $console_data['count']['log']++; |
|
| 43 | + break; |
|
| 44 | + case 'memory': |
|
| 45 | + $message = array( |
|
| 46 | + 'name' => $log['name'], |
|
| 47 | + 'data' => self::getReadableMemory($log['data']), |
|
| 48 | + 'type' => 'memory' |
|
| 49 | + ); |
|
| 50 | + if (!empty($log['data_type'])) { |
|
| 51 | + $message['data_type'] = $log['data_type']; |
|
| 52 | + } |
|
| 53 | + $console_data['count']['memory']++; |
|
| 54 | + break; |
|
| 55 | + case 'error': |
|
| 56 | + $message = array( |
|
| 57 | + 'data' => $log['data'], |
|
| 58 | + 'file' => $log['file'], |
|
| 59 | + 'line' => $log['line'], |
|
| 60 | + 'type' => 'error' |
|
| 61 | + ); |
|
| 62 | + $console_data['count']['error']++; |
|
| 63 | + break; |
|
| 64 | + case 'speed': |
|
| 65 | + $elapsedTime = $log['data'] - $this->startTime; |
|
| 66 | + $message = array( |
|
| 67 | + 'name' => $log['name'], |
|
| 68 | + 'data' => self::getReadableTime($elapsedTime), |
|
| 69 | + 'type' => 'speed' |
|
| 70 | + ); |
|
| 71 | + $console_data['count']['speed']++; |
|
| 72 | + break; |
|
| 73 | + default: |
|
| 74 | + $message = array( |
|
| 75 | + 'data' => "Unrecognized console log type: {$log['type']}", |
|
| 76 | + 'type' => 'error' |
|
| 77 | + ); |
|
| 78 | + $console_data['count']['error']++; |
|
| 79 | + break; |
|
| 80 | + } |
|
| 81 | + array_push($console_data['messages'], $message); |
|
| 82 | + } |
|
| 83 | + $this->output['console'] = $console_data; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * Sets file data |
|
| 88 | + * |
|
| 89 | + * @param array $data |
|
| 90 | + */ |
|
| 91 | + public function setFileData(array $data) |
|
| 92 | + { |
|
| 93 | + $fileData = array( |
|
| 94 | + 'fileList' => array(), |
|
| 95 | + 'fileTotals' => array( |
|
| 96 | + 'count' => count($data), |
|
| 97 | + 'size' => 0, |
|
| 98 | + 'largest' => 0 |
|
| 99 | + ) |
|
| 100 | + ); |
|
| 101 | + |
|
| 102 | + foreach ($data as $file) { |
|
| 103 | + array_push($fileData['fileList'], array( |
|
| 104 | + 'name' => $file['name'], |
|
| 105 | + 'size' => self::getReadableMemory($file['size']) |
|
| 106 | + )); |
|
| 107 | + |
|
| 108 | + $fileData['fileTotals']['size'] += $file['size']; |
|
| 109 | + if ($file['size'] > $fileData['fileTotals']['largest']) { |
|
| 110 | + $fileData['fileTotals']['largest'] = $file['size']; |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + $fileData['fileTotals']['size'] = self::getReadableMemory($fileData['fileTotals']['size']); |
|
| 115 | + $fileData['fileTotals']['largest'] = self::getReadableMemory($fileData['fileTotals']['largest']); |
|
| 116 | + |
|
| 117 | + $this->output['files'] = $fileData['fileList']; |
|
| 118 | + $this->output['fileTotals'] = $fileData['fileTotals']; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Sets memory data |
|
| 123 | + * |
|
| 124 | + * @param array $data |
|
| 125 | + */ |
|
| 126 | + public function setMemoryData(array $data) |
|
| 127 | + { |
|
| 128 | + $this->output['memory'] = array( |
|
| 129 | + 'used' => self::getReadableMemory($data['used']), |
|
| 130 | + 'allowed' => $data['allowed'] |
|
| 131 | + ); |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + public function setQueryData(array $query_data) |
|
| 135 | + { |
|
| 136 | + // the void |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * Sets speed data |
|
| 141 | + * |
|
| 142 | + * @param array $data |
|
| 143 | + */ |
|
| 144 | + public function setSpeedData(array $data) |
|
| 145 | + { |
|
| 146 | + $this->output['speed'] = array( |
|
| 147 | + 'elapsed' => self::getReadableTime($data['elapsed']), |
|
| 148 | + 'allowed' => self::getReadableTime($data['allowed'], 0) |
|
| 149 | + ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Static formatter for human-readable time |
|
| 154 | + * Only handles time up to 60 minutes gracefully |
|
| 155 | + * |
|
| 156 | + * @param double $time |
|
| 157 | + * @param integer $decimals |
|
| 158 | + * @return string |
|
| 159 | + */ |
|
| 160 | + public static function getReadableTime($time, $decimals = 3) |
|
| 161 | + { |
|
| 162 | + $unit = 's'; |
|
| 163 | + if ($time < 1) { |
|
| 164 | + $time *= 1000; |
|
| 165 | + $unit = 'ms'; |
|
| 166 | + } else if ($time > 60) { |
|
| 167 | + $time /= 60; |
|
| 168 | + $unit = 'm'; |
|
| 169 | + } |
|
| 170 | + $time = number_format($time, $decimals); |
|
| 171 | + return "{$time} {$unit}"; |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Static formatter for human-readable memory |
|
| 176 | + * |
|
| 177 | + * @param double $size |
|
| 178 | + * @param integer $decimals |
|
| 179 | + */ |
|
| 180 | + public static function getReadableMemory($size, $decimals = 2) |
|
| 181 | + { |
|
| 182 | + $unitOptions = array('b', 'k', 'M', 'G'); |
|
| 183 | + |
|
| 184 | + $base = log($size, 1024); |
|
| 185 | + |
|
| 186 | + $memory = round(pow(1024, $base - floor($base)), $decimals); |
|
| 187 | + $unit = $unitOptions[floor($base)]; |
|
| 188 | + return "{$memory} {$unit}"; |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | - public function __invoke() |
|
| 192 | - { |
|
| 193 | - $output = $this->output; |
|
| 194 | - require_once __DIR__ .'/../asset/display.tpl.php'; |
|
| 195 | - } |
|
| 191 | + public function __invoke() |
|
| 192 | + { |
|
| 193 | + $output = $this->output; |
|
| 194 | + require_once __DIR__ .'/../asset/display.tpl.php'; |
|
| 195 | + } |
|
| 196 | 196 | } |
@@ -15,82 +15,82 @@ discard block |
||
| 15 | 15 | class PhpQuickProfiler |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** @var Particletree\Pqp\Console */ |
|
| 19 | - protected $console; |
|
| 18 | + /** @var Particletree\Pqp\Console */ |
|
| 19 | + protected $console; |
|
| 20 | 20 | |
| 21 | - /** @var integer */ |
|
| 22 | - protected $startTime; |
|
| 21 | + /** @var integer */ |
|
| 22 | + protected $startTime; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @param Particletree\Pqp\Console $console |
|
| 26 | - * @param integer $startTime |
|
| 27 | - */ |
|
| 28 | - public function __construct(Console $console, $startTime = null) |
|
| 29 | - { |
|
| 30 | - $this->console = $console; |
|
| 24 | + /** |
|
| 25 | + * @param Particletree\Pqp\Console $console |
|
| 26 | + * @param integer $startTime |
|
| 27 | + */ |
|
| 28 | + public function __construct(Console $console, $startTime = null) |
|
| 29 | + { |
|
| 30 | + $this->console = $console; |
|
| 31 | 31 | |
| 32 | - if (is_null($startTime)) { |
|
| 33 | - $startTime = microtime(true); |
|
| 34 | - } |
|
| 35 | - $this->startTime = $startTime; |
|
| 36 | - } |
|
| 32 | + if (is_null($startTime)) { |
|
| 33 | + $startTime = microtime(true); |
|
| 34 | + } |
|
| 35 | + $this->startTime = $startTime; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Get data about files loaded for the application to current point |
|
| 40 | - * |
|
| 41 | - * @returns array |
|
| 42 | - */ |
|
| 43 | - public function gatherFileData() |
|
| 44 | - { |
|
| 45 | - $files = get_included_files(); |
|
| 46 | - $data = array(); |
|
| 47 | - foreach ($files as $file) { |
|
| 48 | - array_push($data, array( |
|
| 49 | - 'name' => $file, |
|
| 50 | - 'size' => filesize($file) |
|
| 51 | - )); |
|
| 52 | - } |
|
| 53 | - return $data; |
|
| 54 | - } |
|
| 38 | + /** |
|
| 39 | + * Get data about files loaded for the application to current point |
|
| 40 | + * |
|
| 41 | + * @returns array |
|
| 42 | + */ |
|
| 43 | + public function gatherFileData() |
|
| 44 | + { |
|
| 45 | + $files = get_included_files(); |
|
| 46 | + $data = array(); |
|
| 47 | + foreach ($files as $file) { |
|
| 48 | + array_push($data, array( |
|
| 49 | + 'name' => $file, |
|
| 50 | + 'size' => filesize($file) |
|
| 51 | + )); |
|
| 52 | + } |
|
| 53 | + return $data; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Get data about memory usage of the application |
|
| 58 | - * |
|
| 59 | - * @returns array |
|
| 60 | - */ |
|
| 61 | - public function gatherMemoryData() |
|
| 62 | - { |
|
| 63 | - $usedMemory = memory_get_peak_usage(); |
|
| 64 | - $allowedMemory = ini_get('memory_limit'); |
|
| 65 | - return array( |
|
| 66 | - 'used' => $usedMemory, |
|
| 67 | - 'allowed' => $allowedMemory |
|
| 68 | - ); |
|
| 69 | - } |
|
| 56 | + /** |
|
| 57 | + * Get data about memory usage of the application |
|
| 58 | + * |
|
| 59 | + * @returns array |
|
| 60 | + */ |
|
| 61 | + public function gatherMemoryData() |
|
| 62 | + { |
|
| 63 | + $usedMemory = memory_get_peak_usage(); |
|
| 64 | + $allowedMemory = ini_get('memory_limit'); |
|
| 65 | + return array( |
|
| 66 | + 'used' => $usedMemory, |
|
| 67 | + 'allowed' => $allowedMemory |
|
| 68 | + ); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | /*-------------------------------------------------------- |
| 72 | 72 | QUERY DATA -- DATABASE OBJECT WITH LOGGING REQUIRED |
| 73 | 73 | ----------------------------------------------------------*/ |
| 74 | 74 | |
| 75 | 75 | public function gatherQueryData() { |
| 76 | - $queryTotals = array(); |
|
| 77 | - $queryTotals['count'] = 0; |
|
| 78 | - $queryTotals['time'] = 0; |
|
| 79 | - $queries = array(); |
|
| 76 | + $queryTotals = array(); |
|
| 77 | + $queryTotals['count'] = 0; |
|
| 78 | + $queryTotals['time'] = 0; |
|
| 79 | + $queries = array(); |
|
| 80 | 80 | |
| 81 | - if($this->db != '') { |
|
| 82 | - $queryTotals['count'] += $this->db->queryCount; |
|
| 83 | - foreach($this->db->queries as $query) { |
|
| 84 | - $query = $this->attemptToExplainQuery($query); |
|
| 85 | - $queryTotals['time'] += $query['time']; |
|
| 86 | - $query['time'] = Display::getReadableTime($query['time']); |
|
| 87 | - $queries[] = $query; |
|
| 88 | - } |
|
| 89 | - } |
|
| 81 | + if($this->db != '') { |
|
| 82 | + $queryTotals['count'] += $this->db->queryCount; |
|
| 83 | + foreach($this->db->queries as $query) { |
|
| 84 | + $query = $this->attemptToExplainQuery($query); |
|
| 85 | + $queryTotals['time'] += $query['time']; |
|
| 86 | + $query['time'] = Display::getReadableTime($query['time']); |
|
| 87 | + $queries[] = $query; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - $queryTotals['time'] = Display::getReadableTime($queryTotals['time']); |
|
| 92 | - $this->output['queries'] = $queries; |
|
| 93 | - $this->output['queryTotals'] = $queryTotals; |
|
| 91 | + $queryTotals['time'] = Display::getReadableTime($queryTotals['time']); |
|
| 92 | + $this->output['queries'] = $queries; |
|
| 93 | + $this->output['queryTotals'] = $queryTotals; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /*-------------------------------------------------------- |
@@ -98,46 +98,46 @@ discard block |
||
| 98 | 98 | ----------------------------------------------------------*/ |
| 99 | 99 | |
| 100 | 100 | function attemptToExplainQuery($query) { |
| 101 | - try { |
|
| 102 | - $sql = 'EXPLAIN '.$query['sql']; |
|
| 103 | - $rs = $this->db->query($sql); |
|
| 104 | - } |
|
| 105 | - catch(Exception $e) {} |
|
| 106 | - if($rs) { |
|
| 107 | - $row = mysql_fetch_array($rs, MYSQL_ASSOC); |
|
| 108 | - $query['explain'] = $row; |
|
| 109 | - } |
|
| 110 | - return $query; |
|
| 101 | + try { |
|
| 102 | + $sql = 'EXPLAIN '.$query['sql']; |
|
| 103 | + $rs = $this->db->query($sql); |
|
| 104 | + } |
|
| 105 | + catch(Exception $e) {} |
|
| 106 | + if($rs) { |
|
| 107 | + $row = mysql_fetch_array($rs, MYSQL_ASSOC); |
|
| 108 | + $query['explain'] = $row; |
|
| 109 | + } |
|
| 110 | + return $query; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Get data about speed of the application |
|
| 115 | - * |
|
| 116 | - * @returns array |
|
| 117 | - */ |
|
| 118 | - public function gatherSpeedData() |
|
| 119 | - { |
|
| 120 | - $elapsedTime = microtime(true) - $this->startTime; |
|
| 121 | - $allowedTime = ini_get('max_execution_time'); |
|
| 122 | - return array( |
|
| 123 | - 'elapsed' => $elapsedTime, |
|
| 124 | - 'allowed' => $allowedTime |
|
| 125 | - ); |
|
| 126 | - } |
|
| 113 | + /** |
|
| 114 | + * Get data about speed of the application |
|
| 115 | + * |
|
| 116 | + * @returns array |
|
| 117 | + */ |
|
| 118 | + public function gatherSpeedData() |
|
| 119 | + { |
|
| 120 | + $elapsedTime = microtime(true) - $this->startTime; |
|
| 121 | + $allowedTime = ini_get('max_execution_time'); |
|
| 122 | + return array( |
|
| 123 | + 'elapsed' => $elapsedTime, |
|
| 124 | + 'allowed' => $allowedTime |
|
| 125 | + ); |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Triggers end display of the profiling data |
|
| 130 | - * |
|
| 131 | - * @param Display $display |
|
| 132 | - */ |
|
| 133 | - public function display(Display $display) |
|
| 134 | - { |
|
| 135 | - $display->setConsole($this->console); |
|
| 136 | - $display->setFileData($this->gatherFileData()); |
|
| 137 | - $display->setMemoryData($this->gatherMemoryData()); |
|
| 138 | - $display->setQueryData($this->gatherQueryData()); |
|
| 139 | - $display->setSpeedData($this->gatherSpeedData()); |
|
| 128 | + /** |
|
| 129 | + * Triggers end display of the profiling data |
|
| 130 | + * |
|
| 131 | + * @param Display $display |
|
| 132 | + */ |
|
| 133 | + public function display(Display $display) |
|
| 134 | + { |
|
| 135 | + $display->setConsole($this->console); |
|
| 136 | + $display->setFileData($this->gatherFileData()); |
|
| 137 | + $display->setMemoryData($this->gatherMemoryData()); |
|
| 138 | + $display->setQueryData($this->gatherQueryData()); |
|
| 139 | + $display->setSpeedData($this->gatherSpeedData()); |
|
| 140 | 140 | |
| 141 | - $display(); |
|
| 142 | - } |
|
| 141 | + $display(); |
|
| 142 | + } |
|
| 143 | 143 | } |