Changeset 1332
- Timestamp:
- 09/05/08 18:21:46 (3 months ago)
- Files:
-
- bb-benchmark/trunk/_bb-benchmark.php (modified) (4 diffs)
- bb-benchmark/trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
bb-benchmark/trunk/_bb-benchmark.php
r1243 r1332 6 6 Author: _ck_ 7 7 Author URI: http://bbShowcase.org 8 Version: 0.2. 18 Version: 0.2.2 9 9 10 10 License: CC-GNU-GPL http://creativecommons.org/licenses/GPL/2.0/ … … 77 77 78 78 // print_r($bbdb->queries); 79 $test=$bbdb->queries; foreach (array_keys($test) as $key) {echo " # ".($key+1)." : ".round($test[$key][1],4)." seconds\n".ereg_replace("--","- - ",$test[$key][0])."\n\n";} 79 $test=$bbdb->queries; 80 foreach (array_keys($test) as $key) { 81 echo " # ".($key+1)." : ".round($test[$key][1],4)." seconds".(isset($test[$key][2]) ? " function ".$test[$key][2] : "")."\n".ereg_replace("--","- - ",$test[$key][0])."\n\n"; 82 } 80 83 81 84 echo "\n\n === executed files === \n"; … … 93 96 } 94 97 add_action('bb_foot', 'bb_benchmark_output',999); 95 add_action('bb_admin_footer', 'bb_benchmark_output' );98 add_action('bb_admin_footer', 'bb_benchmark_output',999); 96 99 97 100 // global $bb_current_user; if ($bb_current_user->data->bb_capabilities['keymaster']) : … … 118 121 add_action( 'bb_index.php', 'bb_benchmark_template_timer' ); 119 122 123 124 function bb_benchmark_get_caller() { // not used here yet - just for reminder/storage 125 if ( !is_callable('debug_backtrace') ) {return '';} // requires PHP 4.3+ 126 127 $bt = debug_backtrace(); $caller = ''; $tail= ''; 128 129 foreach ( $bt as $trace ) { 130 if ( @$trace['class'] == __CLASS__ ) 131 continue; 132 elseif ( strtolower(@$trace['function']) == 'call_user_func_array' ) 133 continue; 134 elseif ( strtolower(@$trace['function']) == 'apply_filters' ) 135 continue; 136 elseif ( strtolower(@$trace['function']) == 'do_action' ) 137 continue; 138 elseif ( strtolower(@$trace['function']) == 'query' ) {$tail=" (query) ".$tail; continue;} 139 elseif ( strtolower(@$trace['function']) == 'bb_query' ) {$tail=" (bb_query) ".$tail; continue;} 140 elseif ( strtolower(@$trace['function']) == 'bb_append_meta' ) {$tail=" (bb_append_meta) ".$tail; continue;} 141 142 $caller = $trace['function'].$tail; 143 break; 144 } 145 return $caller; 146 } 147 148 120 149 ?> bb-benchmark/trunk/readme.txt
r1243 r1332 71 71 72 72 * 0.2.1 : set priority to dead last so ALL queries are tracked in bb_foot, another BB_IS_ADMIN bug 73 74 = Version 0.2.2 (2008-09-05) = 75 76 * 0.2.2 : adds function trace available in bbPress 1.0 - would like to replace with enhanced/deeper trace someday
