From eca8ecc0eb0c080aded135a26cf53ea793fcf32b Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Thu, 7 Sep 2017 17:46:57 -0700
Subject: [PATCH] Time event execution

---
 includes/run.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/includes/run.php b/includes/run.php
index a4af0be..05b8ceb 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}";
-- 
GitLab