diff --git a/includes/run.php b/includes/run.php index a4af0be7e424d4da9c8b04e19c669b6b8451a884..05b8ceba66d5b61b062e0e5743c32b135bcb2a02 100644 --- a/includes/run.php +++ b/includes/run.php @@ -20,12 +20,14 @@ function run_event( $command ) { return; } - // TODO: time event execution + $start = microtime( true ); $output = \WP_CLI::runcommand( $command, array( 'return' => 'all', ) ); + $end = microtime( true ); + // Command failed if ( ! is_object( $output ) || is_wp_error( $output ) ) { trigger_error( 'WP-CLI command failed. (' . var_export( $command, true ) . ')', E_USER_WARNING ); @@ -34,7 +36,10 @@ function run_event( $command ) { } // On success, reformat response for logging - $output->command = $command; + $output->command = $command; + $output->start = $start; + $output->end = $end; + $output->duration = $end - $start; $output = var_export( $output, true ); $output = ACTION . ":\n{$output}";