/** * Write profiler information to the output. * * @param[in] profiler RDS_Profiler Profiler object. */ protected function writeProfiler(RDS_Profiler $profiler) { $memory = $this->convertSizeToHuman($profiler->startMemory); echo "<h1>{$profiler->name} START {$profiler->startTime}.</h1><br />Memory: {$memory}. --- {$profiler->startFileName} {$profiler->startFileLine}<br /><ol style='padding: 20px;'>"; foreach ($profiler->getEvents() as $count => $event) { $startTime = round($event['start_time'] - $profiler->startTime, 3); $endTime = round($event['end_time'] - $profiler->startTime, 3); $deltaTime = round($endTime - $startTime, 3); $startMemory = $this->convertSizeToHuman($event['start_memory']); $endMemory = $this->convertSizeToHuman($event['end_memory']); $deltaMemory = $this->convertSizeToHuman($event['end_memory'] - $event['start_memory']); $message = htmlspecialchars($event['message']); echo "<li>Event #{$count}: [{$startTime} -> {$endTime} ({$deltaTime} delta)] [{$startMemory} -> {$endMemory} ({$deltaMemory} delta)] {$event['message']}.--- {$event['file_name']} {$event['file_line']}</li>"; } $memory = $this->convertSizeToHuman($profiler->endMemory); $delta = $this->convertSizeToHuman($profiler->endMemory - $profiler->startMemory); $totalTime = round($profiler->endTime - $profiler->startTime, 3); echo "</ol>{$profiler->name} END {$profiler->endTime} ({$totalTime} since start). Memory: {$memory} ({$delta} delta). --- {$profiler->endFileName} {$profiler->endFileLine}<br />"; }
/** * Write profiler information to the output. * * @param[in] profiler RDS_Profiler Profiler object. */ protected function writeProfiler(RDS_Profiler $profiler) { if ($this->socket) { // write only if the socket was correctly created. //POG: Remove whitespaces from file name as it breaks the network protocol $fileName = str_replace(' ', '_', $profiler->startFileName); //TODO: Modify this when the handshake set the charset $fileName = iconv($this->charset, 'utf-8', $fileName); $memory = $this->convertSizeToHuman($profiler->startMemory); socket_write($this->socket, "2 {$profiler->name} {$profiler->startTime} {$fileName} {$profiler->startFileLine} Memory: {$memory}." . self::MESSAGE_TERMINATOR); foreach ($profiler->getEvents() as $event) { //POG: Remove whitespaces from file name as it breaks the network protocol $fileName = str_replace(' ', '_', $event['file_name']); //TODO: Modify this when the handshake set the charset $fileName = iconv($this->charset, 'utf-8', $fileName); $message = iconv($this->charset, 'utf-8', $event['message']); $startMemory = $this->convertSizeToHuman($event['start_memory']); $endMemory = $this->convertSizeToHuman($event['end_memory']); $deltaMemory = $this->convertSizeToHuman($event['end_memory'] - $event['start_memory']); socket_write($this->socket, "4 {$profiler->name} {$event['start_time']} {$event['end_time']} {$fileName} {$event['file_line']} [{$startMemory} -> {$endMemory} ({$deltaMemory} delta)] {$message}." . self::MESSAGE_TERMINATOR); } //POG: Remove whitespaces from file name as it breaks the network protocol $fileName = str_replace(' ', '_', $profiler->endFileName); //TODO: Modify this when the handshake set the charset $fileName = iconv($this->charset, 'utf-8', $fileName); $memory = $this->convertSizeToHuman($profiler->endMemory); $delta = $this->convertSizeToHuman($profiler->endMemory - $profiler->startMemory); socket_write($this->socket, "3 {$profiler->name} {$profiler->endTime} {$fileName} {$profiler->endFileLine} Memory: {$memory} ({$delta} delta)." . self::MESSAGE_TERMINATOR); } }
/** * Write profiler information to the output. * * @param[in] profiler RDS_Profiler Profiler object. */ protected function writeProfiler(RDS_Profiler $profiler) { $memory = $this->convertSizeToHuman($profiler->startMemory); $this->write(RDS::DEBUG, "{$profiler->name} START {$profiler->startTime}. Memory: {$memory}.", $profiler->startFileName, $profiler->startFileLine); foreach ($profiler->getEvents() as $count => $event) { $startTime = round($event['start_time'] - $profiler->startTime, 3); $endTime = round($event['end_time'] - $profiler->startTime, 3); $deltaTime = round($endTime - $startTime, 3); $startMemory = $this->convertSizeToHuman($event['start_memory']); $endMemory = $this->convertSizeToHuman($event['end_memory']); $deltaMemory = $this->convertSizeToHuman($event['end_memory'] - $event['start_memory']); $this->write(RDS::DEBUG, "Event #{$count}: [{$startTime} -> {$endTime} ({$deltaTime} delta)] [{$startMemory} -> {$endMemory} ({$deltaMemory} delta)] {$event['message']}.", $event['file_name'], $event['file_line']); } $memory = $this->convertSizeToHuman($profiler->endMemory); $delta = $this->convertSizeToHuman($profiler->endMemory - $profiler->startMemory); $totalTime = round($profiler->endTime - $profiler->startTime, 3); $this->write(RDS::DEBUG, "{$profiler->name} END {$profiler->endTime} ({$totalTime} since start). Memory: {$memory} ({$delta} delta).", $profiler->endFileName, $profiler->endFileLine); }