当前位置: 首页>>代码示例>>PHP>>正文


PHP Profiler::groups方法代码示例

本文整理汇总了PHP中Profiler::groups方法的典型用法代码示例。如果您正苦于以下问题:PHP Profiler::groups方法的具体用法?PHP Profiler::groups怎么用?PHP Profiler::groups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Profiler的用法示例。


在下文中一共展示了Profiler::groups方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: query

 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;
 }
开发者ID:pedrosland,项目名称:kohana-firephp,代码行数:30,代码来源:mysql.php

示例2: getQueries

 /**
  * 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];
 }
开发者ID:alle,项目名称:auto-modeler,代码行数:16,代码来源:test_automodeler_orm.php

示例3: smarty_function_Kohana_profile

/**
 * 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);
}
开发者ID:pg7812,项目名称:kohana-module-smarty,代码行数:28,代码来源:function.Kohana_profile.php

示例4: __destruct

 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);
 }
开发者ID:pedrosland,项目名称:kohana-firephp,代码行数:24,代码来源:firePHP.php

示例5: render_stats

 /**
  * 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.";
 }
开发者ID:AlexKupreev,项目名称:kohanut-core,代码行数:13,代码来源:core.php

示例6: group_stats

 /**
  * 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;
 }
开发者ID:noikiy,项目名称:kohana,代码行数:60,代码来源:Profiler.php

示例7: _statistics

 /**
  * 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())));
 }
开发者ID:anqh,项目名称:core,代码行数:18,代码来源:page.php

示例8: array

<?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);
开发者ID:noikiy,项目名称:kohana,代码行数:31,代码来源:stats.php

示例9: _set_profiler_stats

 /**
  * 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) . '&nbsp;' . __('MB'), '{gleez_version}' => Gleez::VERSION, '{execution_time}' => number_format(microtime(TRUE) - GLEEZ_START_TIME, 3) . '&nbsp;' . __('seconds'), '{included_files}' => count(get_included_files()), '{database_queries}' => $queries);
     // Insert the totals into the response
     $this->template = strtr((string) $this->template, $total);
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:28,代码来源:template.php

示例10: after


//.........这里部分代码省略.........
             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', '&#9650;', 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();
 }
开发者ID:anqh,项目名称:core,代码行数:101,代码来源:template.php

示例11: getSql

 /**
  * @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;
 }
开发者ID:astar3086,项目名称:studio_logistic,代码行数:62,代码来源:ProfilerToolbar.php

示例12: get_benchmarks

 /**
  * 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;
 }
开发者ID:bosoy83,项目名称:progtest,代码行数:29,代码来源:debugtoolbar.php

示例13: getSql

 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;
 }
开发者ID:tscms,项目名称:profilertoolbar,代码行数:38,代码来源:ProfilerToolbar.php

示例14: group_stats

 /**
  * 返回分组对应的性能统计数据
  *
  * @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;
 }
开发者ID:amlun,项目名称:phptools,代码行数:45,代码来源:Profiler.php

示例15: get_benchmark_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;
 }
开发者ID:nexeck,项目名称:kohana-debugger,代码行数:28,代码来源:debugger.php


注:本文中的Profiler::groups方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。