Changeset 44915
- Timestamp:
- 03/15/2019 09:58:01 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/wp-profiler.php
r42343 r44915 19 19 20 20 class WPProfiler { 21 var$stack;22 var$profile;21 public $stack; 22 public $profile; 23 23 24 24 /** 25 25 * PHP5 constructor. 26 26 */ 27 function __construct() {27 public function __construct() { 28 28 $this->stack = array(); 29 29 $this->profile = array(); 30 30 } 31 31 32 function start( $name ) {32 public function start( $name ) { 33 33 $time = $this->microtime(); 34 34 … … 61 61 } 62 62 63 function stop() {63 public function stop() { 64 64 $item = array_pop( $this->stack ); 65 65 $time = $this->microtime( $item['start'] ); … … 107 107 } 108 108 109 function microtime( $since = 0.0 ) {109 public function microtime( $since = 0.0 ) { 110 110 list($usec, $sec) = explode( ' ', microtime() ); 111 111 return (float) $sec + (float) $usec - $since; 112 112 } 113 113 114 function log_filter( $tag ) {114 public function log_filter( $tag ) { 115 115 if ( $this->stack ) { 116 116 global $wp_actions; … … 124 124 } 125 125 126 function log_action( $tag ) {126 public function log_action( $tag ) { 127 127 if ( $this->stack ) { 128 128 @$this->stack[ count( $this->stack ) - 1 ]['actions'][ $tag ] ++; … … 130 130 } 131 131 132 function _current_action() {132 public function _current_action() { 133 133 global $wp_actions; 134 134 return $wp_actions[ count( $wp_actions ) - 1 ]; 135 135 } 136 136 137 function results() {137 public function results() { 138 138 return $this->profile; 139 139 } 140 140 141 function _query_summary( $queries, &$out ) {141 public function _query_summary( $queries, &$out ) { 142 142 foreach ( $queries as $q ) { 143 143 $sql = $q[0]; … … 151 151 } 152 152 153 function _query_count( $queries ) {153 public function _query_count( $queries ) { 154 154 // this requires the savequeries patch at https://core.trac.wordpress.org/ticket/5218 155 155 $out = array(); … … 164 164 } 165 165 166 function _dirty_objects_count( $dirty_objects ) {166 public function _dirty_objects_count( $dirty_objects ) { 167 167 $out = array(); 168 168 foreach ( array_keys( $dirty_objects ) as $group ) { … … 172 172 } 173 173 174 function array_add( $a, $b ) {174 public function array_add( $a, $b ) { 175 175 $out = $a; 176 176 foreach ( array_keys( $b ) as $key ) { … … 184 184 } 185 185 186 function array_sub( $a, $b ) {186 public function array_sub( $a, $b ) { 187 187 $out = $a; 188 188 foreach ( array_keys( $b ) as $key ) { … … 194 194 } 195 195 196 function print_summary() {196 public function print_summary() { 197 197 $results = $this->results(); 198 198
Note: See TracChangeset
for help on using the changeset viewer.