Changeset 47122 for trunk/tests/phpunit/includes/wp-profiler.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/includes/wp-profiler.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/wp-profiler.php
r46586 r47122 2 2 3 3 /* 4 A simple manually-instrumented profiler for WordPress. 5 6 This records basic execution time, and a summary of the actions and SQL queries run within each block. 7 8 start() and stop() must be called in pairs, for example: 9 10 function something_to_profile() { 11 wppf_start(__FUNCTION__); 12 do_stuff(); 13 wppf_stop(); 14 } 15 16 Multiple profile blocks are permitted, and they may be nested. 17 18 */ 4 * A simple manually-instrumented profiler for WordPress. 5 * 6 * This records basic execution time, and a summary of the actions and SQL queries run within each block. 7 * 8 * start() and stop() must be called in pairs, for example: 9 * 10 * function something_to_profile() { 11 * wppf_start(__FUNCTION__); 12 * do_stuff(); 13 * wppf_stop(); 14 * } 15 * 16 * Multiple profile blocks are permitted, and they may be nested. 17 */ 19 18 20 19 class WPProfiler { … … 34 33 35 34 if ( ! $this->stack ) { 36 // log all actions and filters35 // Log all actions and filters. 37 36 add_filter( 'all', array( $this, 'log_filter' ) ); 38 37 } 39 38 40 // reset the wpdb queries log, storing it on the profile stack if necessary39 // Reset the wpdb queries log, storing it on the profile stack if necessary. 41 40 global $wpdb; 42 41 if ( $this->stack ) { … … 152 151 153 152 public function _query_count( $queries ) { 154 // this requires the savequeriespatch at https://core.trac.wordpress.org/ticket/5218153 // This requires the SAVEQUERIES patch at https://core.trac.wordpress.org/ticket/5218 155 154 $out = array(); 156 155 foreach ( $queries as $q ) {
Note: See TracChangeset
for help on using the changeset viewer.