subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1703686 - /subversion/trunk/subversion/svnbench/null-export-cmd.c
Date Thu, 17 Sep 2015 20:37:49 GMT
Author: stefan2
Date: Thu Sep 17 20:37:49 2015
New Revision: 1703686

URL: http://svn.apache.org/viewvc?rev=1703686&view=rev
Log:
Correct the statistics gathered 'svnbench null-export' output.  The start
node was not included into it.

* subversion/svnbench/null-export-cmd.c
  (file_write_handler): New stream function.
  (bench_null_export): Count the root node.  For exports of single files,
                       count the plaintext bytes received.

Modified:
    subversion/trunk/subversion/svnbench/null-export-cmd.c

Modified: subversion/trunk/subversion/svnbench/null-export-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnbench/null-export-cmd.c?rev=1703686&r1=1703685&r2=1703686&view=diff
==============================================================================
--- subversion/trunk/subversion/svnbench/null-export-cmd.c (original)
+++ subversion/trunk/subversion/svnbench/null-export-cmd.c Thu Sep 17 20:37:49 2015
@@ -165,6 +165,15 @@ close_file(void *file_baton,
   return SVN_NO_ERROR;
 }
 
+/* Implement svn_write_fn_t, simply counting the incoming data. */
+static svn_error_t *
+file_write_handler(void *baton, const char *data, apr_size_t *len)
+{
+  edit_baton_t *eb = baton;
+  eb->byte_count += *len;
+
+  return SVN_NO_ERROR;
+}
 
 /*** Public Interfaces ***/
 
@@ -198,6 +207,7 @@ bench_null_export(svn_revnum_t *result_r
       svn_client__pathrev_t *loc;
       svn_ra_session_t *ra_session;
       svn_node_kind_t kind;
+      edit_baton_t *eb = baton;
 
       /* Get the RA connection. */
       SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc,
@@ -211,6 +221,11 @@ bench_null_export(svn_revnum_t *result_r
         {
           apr_hash_t *props;
 
+          /* Since we don't use the editor, we must count "manually". */
+          svn_stream_t *stream = svn_stream_create(eb, pool);
+          svn_stream_set_write(stream, file_write_handler);
+          eb->file_count++;
+
           /* Since you cannot actually root an editor at a file, we
            * manually drive a few functions of our editor. */
 
@@ -218,8 +233,7 @@ bench_null_export(svn_revnum_t *result_r
            * to the repository. */
           /* ### note: the stream will not be closed */
           SVN_ERR(svn_ra_get_file(ra_session, "", loc->rev,
-                                  svn_stream_empty(pool),
-                                  NULL, &props, pool));
+                                  stream, NULL, &props, pool));
         }
       else if (kind == svn_node_dir)
         {
@@ -268,6 +282,10 @@ bench_null_export(svn_revnum_t *result_r
                                      NULL, pool));
 
           SVN_ERR(reporter->finish_report(report_baton, pool));
+
+          /* We don't receive the "add directory" callback for the starting
+           * node. */
+          eb->dir_count++;
         }
       else if (kind == svn_node_none)
         {



Mime
View raw message