Make WordPress Core

Changeset 42789


Ignore:
Timestamp:
03/05/2018 10:53:40 PM (8 years ago)
Author:
johnbillion
Message:

Database: Add the query start time to logged query data.

This allows debugging plugins to plot the time at which queries were executed.

Props Rarst for initial patch.

Fixes #43315

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r42716 r42789  
    175175
    176176        /**
    177          * Saved queries that were executed
     177         * Log of queries that were executed, for debugging purposes.
    178178         *
    179179         * @since 1.5.0
    180          * @var array
     180         * @since 2.5.0 The third element in each query log was added to record the calling functions.
     181         * @since 5.0.0 The fourth element in each query log was added to record the start time.
     182         *
     183         * @var array[] {
     184         *     Array of queries that were executed.
     185         *
     186         *     @type array ...$0 {
     187         *         Data for each query.
     188         *
     189         *         @type string $0 The query's SQL.
     190         *         @type float  $1 Total time spent on the query, in seconds.
     191         *         @type string $2 Comma separated list of the calling functions.
     192         *         @type float  $3 Unix timestamp of the time at the start of the query.
     193         *     }
     194         * }
    181195         */
    182196        var $queries;
     
    19872001
    19882002                if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
    1989                         $this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );
     2003                        $this->queries[] = array(
     2004                                $query,
     2005                                $this->timer_stop(),
     2006                                $this->get_caller(),
     2007                                $this->time_start,
     2008                        );
    19902009                }
    19912010        }
     
    34943513         * @since 2.5.0
    34953514         *
    3496          * @return string|array The name of the calling function
     3515         * @return string Comma separated list of the calling functions.
    34973516         */
    34983517        public function get_caller() {
Note: See TracChangeset for help on using the changeset viewer.