protected function _debugTimer() { $count = count(iaSystem::$timer) - 1; $totalTime = 0; $text = ''; $last[0] = $last[1] = iaSystem::$timer[0]['time']; $start = iaSystem::$timer[0]['time']; $end = iaSystem::$timer[$count]['time']; $totalRealTime = number_format($end[1] + $end[0] - ($start[1] + $start[0]), 5, '.', ''); for ($i = 0; $i < $count; $i++) { $memoryUsed = (int) iaSystem::$timer[$i]['bytes']; $memoryInPrevIteration = $i ? (int) iaSystem::$timer[$i - 1]['bytes'] : 0; $start = (double) $last[0][1] + (double) $last[0][0]; $end = iaSystem::$timer[$i]['time'][1] + iaSystem::$timer[$i]['time'][0]; $times = number_format((double) $end - $start, 5, '.', ''); $perc = ceil(($memoryUsed - $memoryInPrevIteration) * 100 / $memoryUsed); if ($times > 0.0001) { $last[0] = $last[1] = iaSystem::$timer[$i]['time']; $totalTime += $times; $text .= '<tr><td class="iterator" rowspan="2">' . $i . '.</td> <td rowspan="2" class="noborder"> <i>' . iaSystem::$timer[$i]['description'] . '</i> <br /> ' . ($perc >= 5 ? '<font color="orange"><i>memory up:</i></font> ' . $perc . '%' : '') . '</td> <td><b>Rendering time:</b></td> <td>' . ($times > 0.01 ? '<font color="red">' . $times * 1000 . '</font>' : $times * 1000) . ' ms (' . $totalTime . ' s)</td> </tr> <tr> <td width="100"><b>Memory usage:</b></td> <td width="150">' . iaSystem::byteView($memoryUsed) . ' (' . number_format($memoryUsed, 0, '', ' ') . ')</td> </tr>'; } } $search = array('START', 'END'); $replace = array('<b class="d_green">START</b>', '<b class="d_red">END</b>'); $text = str_replace($search, $replace, '<b>Real time render:</b> ' . $totalRealTime . '<br /> <b>Math time render:</b> ' . $totalTime . '<br /> <b>Memory usage:</b> ' . iaSystem::byteView($memoryUsed) . '(' . number_format($memoryUsed, 0, '', ' ') . 'b) <table>' . $text . '</table>'); echo $text; return '[Time: ' . $totalRealTime . '] [Mem.: ' . iaSystem::byteView($memoryUsed) . ']'; }
public function factoryPlugin($plugin, $type = self::FRONT, $name = null) { if (empty($name)) { $name = $plugin; } $class = self::CLASSNAME_PREFIX . ucfirst(strtolower($name)); if (!isset($this->_classInstances[$class])) { $fileSize = $this->loadClass($type, $name, $plugin); if (false === $fileSize) { return false; } iaDebug::debug('<b>plugin:</b> ia.' . $type . '.' . $name . ' (' . iaSystem::byteView($fileSize) . ')', 'Initialized Classes List', 'info'); $this->_classInstances[$class] = new $class(); $this->_classInstances[$class]->init(); } return $this->_classInstances[$class]; }