public function query($type, $sql, $as_object) { if (isset($this->_config['connection']) === true) { $this->database = $this->_config['connection']['database']; } $result = parent::query($type, $sql, false); if ($type === Database::SELECT) { $table = array(); if (count($result) > 0) { foreach ($result->current() as $key => $data) { $table[0][] = $key; } $result->rewind(); foreach ($result as $row) { $table[] = $row; } $result->rewind(); } else { $table[] = array('No', 'rows'); } $group = Profiler::groups(); $group = Profiler::total($group['database (default)'][$sql][0]); FirePHP::getInstance()->table($this->database . ' : (' . number_format($group[0], 6) . 's) ' . $sql, $table); } elseif ($type === Database::INSERT) { FirePHP::getInstance()->info($this->database . ' : Insert id: ' . $result[0] . ' Affected rows: ' . $result[1]); } else { FirePHP::getInstance()->info($this->database . ' : Affected rows: ' . $result[0]); } return $result; }
/** * Get the currently logged set of queries from the database profiling. * * @param string $database The database the queries will be logged under. * @return array Map of queries from the Profiler class * @author Marcus Cobden */ public function getQueries($database = 'default') { $database = "database ({$database})"; $groups = Profiler::groups(); if (!array_key_exists($database, $groups)) { return array(); } return $groups[$database]; }
/** * Smarty {fetch} plugin * * Type: function<br> * Name: fetch<br> * Purpose: fetch file, web or ftp data and display results * @link http://smarty.php.net/manual/en/language.function.fetch.php {fetch} * (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * @param array * @param Smarty * @return string|null if the assign parameter is passed, Smarty assigns the * result to a template variable */ function smarty_function_Kohana_profile($params, &$smarty) { $groups = Profiler::groups(); $profile = array(); foreach ($groups as $group_name => $group) { foreach ($group as $name => $member) { $stats = Profiler::stats($member); $profile[] = array('group_name' => $group_name, 'name' => $name, 'count' => count($member), 'total_time' => $stats['total']['time'], 'min_time' => $stats['min']['time'], 'max_time' => $stats['max']['time'], 'average_time' => $stats['average']['time'], 'total_memory' => $stats['total']['memory'], 'min_memory' => $stats['min']['memory'], 'max_memory' => $stats['max']['memory'], 'average_memory' => $stats['average']['memory']); } } $stats = Profiler::application(); $profile[] = array('group_name' => 'Application timings', 'name' => 'Application timings', 'count' => $stats['count'], 'total_time' => $stats['total']['time'], 'min_time' => $stats['min']['time'], 'max_time' => $stats['max']['time'], 'average_time' => $stats['average']['time'], 'total_memory' => $stats['total']['memory'], 'min_memory' => $stats['min']['memory'], 'max_memory' => $stats['max']['memory'], 'average_memory' => $stats['average']['memory']); $smarty->assign('Kohana_profile', $profile); }
public function __destruct() { $app = Profiler::application(); $group = Profiler::groups(); $table = array(); $table[] = array('Type', 'Time (s)', 'Mem (kb)'); foreach ($group as $rName => $route) { $table[] = array($rName); foreach ($route as $tName => $type) { foreach ($type as $stat) { $stats = Profiler::total($stat); $table[] = array($tName, number_format($stats[0], 6), number_format($stats[1] / 1024, 4)); } } } $this->fire->info(Session::instance()->as_array(), 'Session'); $this->fire->group('Stats: ' . $app['count']); $this->fire->info('Min: ' . number_format($app['min']['time'], 6) . 's ' . number_format($app['min']['memory'] / 1024, 4) . 'kb'); $this->fire->info('Max: ' . number_format($app['max']['time'], 6) . 's ' . number_format($app['max']['memory'] / 1024, 4) . 'kb'); $this->fire->info('Average: ' . number_format($app['average']['time'], 6) . 's ' . number_format($app['average']['memory'] / 1024, 4) . 'kb'); $this->fire->info('Total: ' . number_format($app['total']['time'], 6) . 's ' . number_format($app['total']['memory'] / 1024, 4) . 'kb'); $this->fire->groupEnd(); //$this->fire->table('Execution stats ('.number_format($endTime, 6).'s '.number_format($endMem, 4).'kb)', $table); }
/** * Print some render stats * * @return string */ public static function render_stats() { $run = Profiler::application(); $run = $run['current']; $queries = Profiler::groups(); $queries = count($queries['database (default)']); return "Page rendered in " . Num::format($run['time'], 3) . " seconds using " . Num::format($run['memory'] / 1024 / 1024, 2) . "MB and " . $queries . " queries."; }
/** * Gets the min, max, average and total of profiler groups as an array. * * $stats = Profiler::group_stats('test'); * * @param mixed $groups single group name string, or array with group names; all groups by default * @return array min, max, average, total * @uses Profiler::groups * @uses Profiler::stats */ public static function group_stats($groups = NULL) { // Which groups do we need to calculate stats for? $groups = $groups === NULL ? Profiler::groups() : array_intersect_key(Profiler::groups(), array_flip((array) $groups)); // All statistics $stats = array(); foreach ($groups as $group => $names) { foreach ($names as $name => $tokens) { // Store the stats for each subgroup. // We only need the values for "total". $_stats = Profiler::stats($tokens); $stats[$group][$name] = $_stats['total']; } } // Group stats $groups = array(); foreach ($stats as $group => $names) { // Min and max are unknown by default $groups[$group]['min'] = $groups[$group]['max'] = array('time' => NULL, 'memory' => NULL); // Total values are always integers $groups[$group]['total'] = array('time' => 0, 'memory' => 0); foreach ($names as $total) { if (!isset($groups[$group]['min']['time']) or $groups[$group]['min']['time'] > $total['time']) { // Set the minimum time $groups[$group]['min']['time'] = $total['time']; } if (!isset($groups[$group]['min']['memory']) or $groups[$group]['min']['memory'] > $total['memory']) { // Set the minimum memory $groups[$group]['min']['memory'] = $total['memory']; } if (!isset($groups[$group]['max']['time']) or $groups[$group]['max']['time'] < $total['time']) { // Set the maximum time $groups[$group]['max']['time'] = $total['time']; } if (!isset($groups[$group]['max']['memory']) or $groups[$group]['max']['memory'] < $total['memory']) { // Set the maximum memory $groups[$group]['max']['memory'] = $total['memory']; } // Increase the total time and memory $groups[$group]['total']['time'] += $total['time']; $groups[$group]['total']['memory'] += $total['memory']; } // Determine the number of names (subgroups) $count = count($names); // Determine the averages $groups[$group]['average']['time'] = $groups[$group]['total']['time'] / $count; $groups[$group]['average']['memory'] = $groups[$group]['total']['memory'] / $count; } return $groups; }
/** * Render page statistics. * * @return string */ private function _statistics() { // Count DB queries $queries = 0; if (Kohana::$profiling) { foreach (Profiler::groups() as $group => $benchmarks) { if (strpos($group, 'database') === 0) { $queries += count($benchmarks); } } } return __('Page rendered in :execution_time seconds, using :memory_usage of memory, :database_queries database queries and :included_files files', array(':memory_usage' => number_format((memory_get_peak_usage() - KOHANA_START_MEMORY) / 1024, 2) . 'KB', ':execution_time' => number_format(microtime(true) - KOHANA_START_TIME, 5), ':database_queries' => $queries, ':included_files' => count(get_included_files()))); }
<?php include Kohana::find_file('views', 'profiler/style', 'css'); ?> </style> <?php $group_stats = Profiler::group_stats(); $group_cols = array('min', 'max', 'average', 'total'); $application_cols = array('min', 'max', 'average', 'current'); ?> <div class="kohana-waper"> <div style="height:30px;background:#999" id="kohana-stats-btn"></div> <div class="kohana" id="kohana-stats"> <?php foreach (Profiler::groups() as $group => $benchmarks) { ?> <table class="profiler"> <tr class="group"> <th class="name" rowspan="2"><?php echo __(ucfirst($group)); ?> </th> <td class="time" colspan="4"><?php echo number_format($group_stats[$group]['total']['time'], 6); ?> <abbr title="seconds">s</abbr></td> </tr> <tr class="group"> <td class="memory" colspan="4"><?php echo number_format($group_stats[$group]['total']['memory'] / 1024, 4);
/** * Set the profiler stats into template * * @uses Profiler::groups * * @link http://php.net/manual/en/function.number-format.php number_format * @link http://php.net/manual/en/function.get-included-files.php get_included_files */ protected function _set_profiler_stats() { $queries = 0; if (Kohana::$profiling) { // DB queries foreach (Profiler::groups() as $group => $benchmarks) { if (strpos($group, 'database') === 0) { $queries += count($benchmarks); } } } // HHVM's reported memory usage from memory_get_peak_usage() // is not useful when passing false, but we continue passing // false for consistency of historical data in zend. $realMemoryUsage = Request::isHHVM(); // Get the total memory and execution time $total = array('{memory_usage}' => number_format((memory_get_peak_usage($realMemoryUsage) - GLEEZ_START_MEMORY) / 1024 / 1024, 2) . ' ' . __('MB'), '{gleez_version}' => Gleez::VERSION, '{execution_time}' => number_format(microtime(TRUE) - GLEEZ_START_TIME, 3) . ' ' . __('seconds'), '{included_files}' => count(get_included_files()), '{database_queries}' => $queries); // Insert the totals into the response $this->template = strtr((string) $this->template, $total); }
/** * Destroy controller */ public function after() { if ($this->ajax || $this->internal) { // AJAX and HMVC requests $this->response->body($this->response->body() . ''); } else { if ($this->auto_render) { // Normal requests $session = Session::instance(); // Save current URI /* Moved to Controller if ($this->history && $this->response->status() < 400) { $uri = $this->request->current_uri(); unset($this->breadcrumb[$uri]); $this->breadcrumb = array_slice($this->breadcrumb, -9, 9, true); $this->breadcrumb[$uri] = $this->page_title; $session ->set('history', $uri . ($_GET ? URL::query($_GET) : '')) ->set('breadcrumb', $this->breadcrumb); } */ // Controller name as the default page id if none set empty($this->page_id) and $this->page_id = $this->request->controller(); // Stylesheets $styles = array('ui/boot.css' => null, 'ui/typo.css' => null, 'ui/base.css' => null, 'ui/jquery-ui.css' => null, 'http://fonts.googleapis.com/css?family=Nobile:regular,bold' => null); // Generic views Widget::add('breadcrumb', View::factory('generic/breadcrumb', array('breadcrumb' => $this->breadcrumb, 'last' => !$this->history))); Widget::add('actions', View::factory('generic/actions', array('actions' => $this->page_actions))); Widget::add('navigation', View::factory('generic/navigation', array('items' => Kohana::$config->load('site.menu'), 'selected' => $this->page_id))); if (!empty($this->tabs)) { Widget::add('subnavigation', View::factory('generic/navigation', array('items' => $this->tabs, 'selected' => $this->tab_id))); } /* Widget::add('tabs', View::factory('generic/tabs_top', array( 'tabs' => $this->tabs, 'selected' => $this->tab_id ))); */ // Footer Widget::add('footer', View_Module::factory('events/event_list', array('mod_id' => 'footer-events-new', 'mod_class' => 'article grid4 first cut events', 'mod_title' => __('New events'), 'events' => Model_Event::factory()->find_new(10)))); Widget::add('footer', View_Module::factory('forum/topiclist', array('mod_id' => 'footer-topics-active', 'mod_class' => 'article grid4 cut topics', 'mod_title' => __('New posts'), 'topics' => Model_Forum_Topic::factory()->find_by_latest_post(10)))); Widget::add('footer', View_Module::factory('blog/entry_list', array('mod_id' => 'footer-blog-entries', 'mod_class' => 'article grid4 cut blogentries', 'mod_title' => __('New blogs'), 'entries' => Model_Blog_Entry::factory()->find_new(10)))); // Skin $skins = Kohana::$config->load('site.skins'); $skin = 'dark'; //$session->get('skin', 'dark'); $skin_imports = array('ui/mixin.less', 'ui/grid.less', 'ui/layout.less', 'ui/widget.less', 'ui/custom.less'); // Dock $classes = array(); foreach ($skins as $skin_name => &$skin_config) { $skin_config['path'] = 'ui/' . $skin_name . '/skin.less'; $classes[] = HTML::anchor(Route::get('setting')->uri(array('action' => 'skin', 'value' => $skin_name)), $skin_config['name'], array('class' => 'theme', 'rel' => $skin_name)); } //Widget::add('dock', __('Theme') . ': ' . implode(', ', $classes)); // Language selection $available_languages = Kohana::$config->load('locale.languages'); if (count($available_languages)) { $languages = array(); foreach ($available_languages as $lang => $locale) { $languages[] = HTML::anchor('set/lang/' . $lang, HTML::chars($locale[2])); } // Widget::add('dock', ' | ' . __('Language: ') . implode(', ', $languages)); } // Search /* Widget::add('search', View_Module::factory('generic/search', array( 'mod_id' => 'search' ))); */ // Visitor card Widget::add('visitor', View::factory('generic/visitor', array('user' => self::$user))); // Time & weather Widget::add('dock', ' | ' . View::factory('generic/clock', array('user' => self::$user))); // Pin Widget::add('dock', ' | ' . HTML::anchor('#pin', '▲', array('title' => __('Lock menu'), 'class' => 'icon unlock', 'onclick' => '$("#header").toggleClass("pinned"); return false;'))); // End Widget::add('end', View::factory('generic/end')); // Analytics if ($google_analytics = Kohana::$config->load('site.google_analytics')) { Widget::add('head', HTML::script_source("\nvar tracker;\nhead.js(\n\t{ 'google-analytics': 'http://www.google-analytics.com/ga.js' },\n\tfunction() {\n\t\ttracker = _gat._getTracker('" . $google_analytics . "');\n\t\ttracker._trackPageview();\n\t}\n);\n")); } // Open Graph $og = array(); foreach ((array) Anqh::open_graph() as $key => $value) { $og[] = '<meta property="' . $key . '" content="' . HTML::chars($value) . '" />'; } if (!empty($og)) { Widget::add('head', implode("\n", $og)); } // Share if (Anqh::share()) { if ($share = Kohana::$config->load('site.share')) { // 3rd party share Widget::add('share', View_Module::factory('share/share', array('mod_class' => 'like', 'id' => $share))); Widget::add('foot', View::factory('share/foot', array('id' => $share))); } else { if ($facebook = Kohana::$config->load('site.facebook')) { // Facebook Like Widget::add('share', View_Module::factory('facebook/like')); Widget::add('ad_top', View::factory('facebook/connect', array('id' => $facebook))); } } } // Ads $ads = Kohana::$config->load('site.ads'); if ($ads && $ads['enabled']) { foreach ($ads['slots'] as $ad => $slot) { Widget::add($slot, View::factory('ads/' . $ad), Widget::MIDDLE); } } // And finally the profiler stats if (self::$user && self::$user->has_role('admin')) { //in_array(Kohana::$environment, array(Kohana::DEVELOPMENT, Kohana::TESTING))) { Widget::add('foot', View::factory('generic/debug')); Widget::add('foot', View::factory('profiler/stats')); } // Do some CSS magic to page class $page_class = explode(' ', $this->language . ' ' . $session->get('page_width', 'fixed') . ' ' . $session->get('page_main', 'left') . ' ' . $this->request->action() . ' ' . $this->page_class); // Controller set classes $page_class = implode(' ', array_unique(array_map('trim', $page_class))); // Bind the generic page variables $this->template->set('styles', $styles)->set('skin', $skin)->set('skins', $skins)->set('skin_imports', $skin_imports)->set('language', $this->language)->set('page_id', $this->page_id)->set('page_class', $page_class)->set('page_title', $this->page_title)->set('page_subtitle', $this->page_subtitle); // Add statistics $queries = 0; if (Kohana::$profiling) { foreach (Profiler::groups() as $group => $benchmarks) { if (strpos($group, 'database') === 0) { $queries += count($benchmarks); } } } $total = array('{memory_usage}' => number_format((memory_get_peak_usage() - KOHANA_START_MEMORY) / 1024, 2) . 'KB', '{execution_time}' => number_format(microtime(true) - KOHANA_START_TIME, 5), '{database_queries}' => $queries, '{included_files}' => count(get_included_files())); $this->template = strtr($this->template, $total); // Render page if ($this->auto_render === true) { $this->response->body($this->template); } } } return parent::after(); }
/** * @return array|int|string */ private static function getSql() { // calc explain if (self::cfg('html.showSqlExplain') && self::cfg('html.showSqlExplain')) { /*Перебераем все вкладки*/ foreach (self::$_SQL as $instance => $query) { /**/ foreach ($query as $sql => $data) { if (stripos($sql, 'select') === 0) { if (class_exists('\\Database\\ActiveRecord\\Record')) { $pdo = \Database\ActiveRecord\Record::$db->getPdoInstance(); try { /* $stmt = $pdo->prepare('EXPLAIN '.$sql); //$stmt->execute(); $expl = $stmt->fetchAll(PDO::FETCH_ASSOC);*/ } catch (PDOException $e) { self::addData($e, 'PDOException'); } } else { $expl = Database::instance($instance)->query(Database::SELECT, 'EXPLAIN ' . $sql)->as_array(); } self::$_SQL[$instance][$sql]['explain'] = $expl; } } } } // collect data $sql = []; $groups = Profiler::groups(); foreach ($groups as $groupName => $benchmarks) { if (strpos($groupName, 'database') !== 0) { continue; } $sqlGroup = preg_replace('/(.*) \\(\'(.*)\'\\)/Usi', '$2', $groupName); /*$sqlGroup = substr($groupName, strpos($groupName, '(') + 2, strpos($groupName, ')') - strpos($groupName, '(') - 2); */ $sql[$sqlGroup] = ['data' => [], 'total' => ['time' => 0, 'memory' => 0, 'count' => 0]]; foreach ($benchmarks as $benchName => $tokens) { foreach ($tokens as $token) { $stats = Profiler::stats([$token]); $sql_string = $benchName; if (isset(self::$_SQL[$sqlGroup][$benchName]['data'])) { if (strpos($sql_string, ":")) { foreach (self::$_SQL[$sqlGroup][$benchName]['data'] as $key => $value) { $sql_string = preg_replace('|' . $key . '|Usi', "'" . $value . "'", $sql_string); } } } $sql[$sqlGroup]['data'][] = ['sql' => $sql_string, 'time' => $stats['total']['time'], 'memory' => $stats['total']['memory'], 'rows' => isset(self::$_SQL[$sqlGroup][$benchName]) ? self::$_SQL[$sqlGroup][$benchName]['rows'] : null, 'explain' => isset(self::$_SQL[$sqlGroup][$benchName]) ? self::$_SQL[$sqlGroup][$benchName]['explain'] : null]; $sql[$sqlGroup]['total']['time'] += $stats['total']['time']; $sql[$sqlGroup]['total']['memory'] += $stats['total']['memory']; $sql[$sqlGroup]['total']['count']++; } } } return $sql; }
/** * Creates a formatted array of all Benchmarks * * @return array formatted benchmarks */ public static function get_benchmarks() { if (Kohana::$profiling == FALSE) { return array(); } if (self::$_benchmarks !== FALSE) { return self::$_benchmarks; } $groups = Profiler::groups(); $result = array(); foreach (array_keys($groups) as $group) { if (strpos($group, 'database (') === FALSE) { foreach ($groups[$group] as $name => $marks) { $stats = Profiler::stats($marks); $result[$group][] = array('name' => $name, 'count' => count($marks), 'total_time' => $stats['total']['time'], 'avg_time' => $stats['average']['time'], 'total_memory' => $stats['total']['memory'], 'avg_memory' => $stats['average']['memory']); } } } // add total stats $total = Profiler::application(); $result['application'] = array('count' => 1, 'total_time' => $total['current']['time'], 'avg_time' => $total['average']['time'], 'total_memory' => $total['current']['memory'], 'avg_memory' => $total['average']['memory']); self::$_benchmarks = $result; return $result; }
private static function getSql() { // calc explain if (self::cfg('html.showSqlExplain') && self::cfg('html.showSqlExplain')) { foreach (self::$_SQL as $instance => $query) { foreach ($query as $sql => $data) { if (stripos($sql, 'select') === 0) { $explain = Database::instance($instance)->query(Database::SELECT, 'EXPLAIN ' . $sql)->as_array(); self::$_SQL[$instance][$sql]['explain'] = $explain; } } } } // collect data $sql = array(); $groups = Profiler::groups(); foreach ($groups as $groupName => $benchmarks) { if (strpos($groupName, 'database') !== 0) { continue; } $sqlGroup = substr($groupName, strpos($groupName, '(') + 1, strpos($groupName, ')') - strpos($groupName, '(') - 1); $sql[$sqlGroup] = array('data' => array(), 'total' => array('time' => 0, 'memory' => 0, 'count' => 0)); foreach ($benchmarks as $benchName => $tokens) { // skip explain queries if (stripos(trim($benchName), 'explain') === 0) { continue; } foreach ($tokens as $token) { $stats = Profiler::stats(array($token)); $sql[$sqlGroup]['data'][] = array('sql' => $benchName, 'time' => $stats['total']['time'], 'memory' => $stats['total']['memory'], 'rows' => isset(self::$_SQL[$sqlGroup][$benchName]) ? self::$_SQL[$sqlGroup][$benchName]['rows'] : null, 'explain' => isset(self::$_SQL[$sqlGroup][$benchName]) ? self::$_SQL[$sqlGroup][$benchName]['explain'] : null); $sql[$sqlGroup]['total']['time'] += $stats['total']['time']; $sql[$sqlGroup]['total']['memory'] += $stats['total']['memory']; $sql[$sqlGroup]['total']['count']++; } } } return $sql; }
/** * 返回分组对应的性能统计数据 * * @param string $groups * @return array [min, max, average, total] * @uses Profiler::groups * @uses Profiler::stats * @example $stats = Profiler::group_stats('resize'); */ public static function group_stats($groups = NULL) { $groups = $groups === NULL ? Profiler::groups() : array_intersect_key(Profiler::groups(), array_flip((array) $groups)); $stats = array(); foreach ($groups as $group => $names) { foreach ($names as $name => $tokens) { $_stats = Profiler::stats($tokens); $stats[$group][$name] = $_stats['total']; } } $groups = array(); foreach ($stats as $group => $names) { $groups[$group]['min'] = $groups[$group]['max'] = array('time' => NULL, 'memory' => NULL); $groups[$group]['total'] = array('time' => 0, 'memory' => 0); foreach ($names as $total) { if (!isset($groups[$group]['min']['time']) or $groups[$group]['min']['time'] > $total['time']) { $groups[$group]['min']['time'] = $total['time']; } if (!isset($groups[$group]['min']['memory']) or $groups[$group]['min']['memory'] > $total['memory']) { $groups[$group]['min']['memory'] = $total['memory']; } if (!isset($groups[$group]['max']['time']) or $groups[$group]['max']['time'] < $total['time']) { $groups[$group]['max']['time'] = $total['time']; } if (!isset($groups[$group]['max']['memory']) or $groups[$group]['max']['memory'] < $total['memory']) { $groups[$group]['max']['memory'] = $total['memory']; } $groups[$group]['total']['time'] += $total['time']; $groups[$group]['total']['memory'] += $total['memory']; } $count = count($names); $groups[$group]['average']['time'] = $groups[$group]['total']['time'] / $count; $groups[$group]['average']['memory'] = $groups[$group]['total']['memory'] / $count; } return $groups; }
/** * Get benchmark groups * * <code> * Debugger::get_benchmark_groups() * </code> * * @return array formatted benchmarks */ public static function get_benchmark_groups() { if (Kohana::$profiling === false) { return array(); } if (empty(Debugger::$_benchmark_groups) === false) { return Debugger::$_benchmark_groups; } $groups = Profiler::groups(); $result = array(); foreach (array_keys($groups) as $group) { if (strpos($group, 'database (') === false) { foreach ($groups[$group] as $name => $marks) { $result[$group][] = array('name' => $name, 'count' => count($marks), 'stats' => Profiler::stats($marks)); } } } return $result; }
public function benchmark($table = FALSE) { if ($this->enabled) { foreach (Profiler::groups() as $group => $benchmarks) { $tablename = ucfirst($group); // Exclude database unless specifically run if (empty($table) and strpos($tablename, 'Database') === FALSE or strpos($tablename, $table) === 0) { $row = array(array(__('Benchmark'), __('Min'), __('Max'), __('Average'), __('Total'))); foreach ($benchmarks as $name => $tokens) { $stats = Profiler::stats($tokens); $cell = array($name . ' (' . count($tokens) . ')'); foreach (array('min', 'max', 'average', 'total') as $key) { $cell[] = ' ' . number_format($stats[$key]['time'], 6) . ' ' . __('seconds'); } $row[] = $cell; } $cell = array(''); foreach (array('min', 'max', 'average', 'total') as $key) { $cell[] = ' ' . number_format($stats[$key]['memory'] / 1024, 4) . ' kb'; } $row[] = $cell; // Translate before passing... $this->fb(array(__($tablename), $row), FirePHP::TABLE); } } if (empty($table) || strpos('Application', $table) === 0) { $stats = Profiler::application(); $tablename = array(__('Application Execution') . ' (' . $stats['count'] . ')'); $row = array(array('', 'min', 'max', 'average', 'current')); $cell = array('Time'); foreach (array('min', 'max', 'average', 'current') as $key) { $cell[] = number_format($stats[$key]['time'], 6) . ' ' . __('seconds'); } $row[] = $cell; $cell = array('Memory'); foreach (array('min', 'max', 'average', 'current') as $key) { $cell[] = number_format($stats[$key]['memory'] / 1024, 4) . ' kb'; } $row[] = $cell; $this->fb(array($tablename, $row), FirePHP::TABLE); } } return $this; }