You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/09/16 13:01:16 UTC

svn commit: r1703383 - /subversion/trunk/subversion/svnbench/svnbench.c

Author: stefan2
Date: Wed Sep 16 11:01:15 2015
New Revision: 1703383

URL: http://svn.apache.org/r1703383
Log:
Show time taken in svnbench's non-quiet output.

* subversion/svnbench/svnbench.c
  (sub_main): If there was no error and we are not simply showing help,
              show the time taken as the last line (if not in quiet mode).

Modified:
    subversion/trunk/subversion/svnbench/svnbench.c

Modified: subversion/trunk/subversion/svnbench/svnbench.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnbench/svnbench.c?rev=1703383&r1=1703382&r2=1703383&view=diff
==============================================================================
--- subversion/trunk/subversion/svnbench/svnbench.c (original)
+++ subversion/trunk/subversion/svnbench/svnbench.c Wed Sep 16 11:01:15 2015
@@ -371,6 +371,7 @@ sub_main(int *exit_code, int argc, const
   svn_config_t *cfg_config;
   svn_boolean_t descend = TRUE;
   svn_boolean_t use_notifier = TRUE;
+  apr_time_t start_time, time_taken;
 
   received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
 
@@ -939,7 +940,10 @@ sub_main(int *exit_code, int argc, const
   ctx->conflict_baton2 = NULL;
 
   /* And now we finally run the subcommand. */
+  start_time = apr_time_now();
   err = (*subcommand->cmd_func)(os, &command_baton, pool);
+  time_taken = apr_time_now() - start_time;
+
   if (err)
     {
       /* For argument-related problems, suggest using the 'help'
@@ -968,6 +972,14 @@ sub_main(int *exit_code, int argc, const
 
       return err;
     }
+  else if ((subcommand->cmd_func != svn_cl__help) && !opt_state.quiet)
+    {
+      /* This formatting lines up nicely with the output of our sub-commands
+       * and gives musec resolution while not overflowing for 30 years. */
+      SVN_ERR(svn_cmdline_printf(pool,
+                                _("%15.6f seconds taken\n"),
+                                time_taken / 1.0e6));
+    }
 
   return SVN_NO_ERROR;
 }