Index: subversion/libsvn_client/blame.c =================================================================== --- subversion/libsvn_client/blame.c (revision 1041582) +++ subversion/libsvn_client/blame.c (working copy) @@ -22,6 +22,7 @@ */ #include +#include #include "client.h" @@ -42,6 +43,12 @@ #include +static long diff_time = 0L; +static long blame_process_time = 0L; +static long delta_process_time = 0L; +static long file_rev_time = 0L; +static long window_time = 0L; + /* The metadata associated with a particular revision. */ struct rev { @@ -260,7 +267,9 @@ output_diff_modified(void *baton, struct diff_baton *db = baton; if (original_length) - SVN_ERR(blame_delete_range(db->chain, modified_start, original_length)); + { + SVN_ERR(blame_delete_range(db->chain, modified_start, original_length)); + } if (modified_length) SVN_ERR(blame_insert_range(db->chain, db->rev, modified_start, @@ -285,10 +294,16 @@ add_file_blame(const char *last_file, const svn_diff_file_options_t *diff_options, apr_pool_t *pool) { + apr_time_t start_time; + long result_time; + if (!last_file) { SVN_ERR_ASSERT(chain->blame == NULL); + start_time = apr_time_now(); chain->blame = blame_create(chain, rev, 0); + result_time = apr_time_now() - start_time; + blame_process_time += result_time; } else { @@ -299,9 +314,15 @@ add_file_blame(const char *last_file, diff_baton.rev = rev; /* We have a previous file. Get the diff and adjust blame info. */ + start_time = apr_time_now(); SVN_ERR(svn_diff_file_diff_2(&diff, last_file, cur_file, diff_options, pool)); + result_time = apr_time_now() - start_time; + diff_time += result_time; + start_time = apr_time_now(); SVN_ERR(svn_diff_output(diff, &diff_baton, &output_fns)); + result_time = apr_time_now() - start_time; + blame_process_time += result_time; } return SVN_NO_ERROR; @@ -313,13 +334,23 @@ window_handler(svn_txdelta_window_t *window, void struct delta_baton *dbaton = baton; struct file_rev_baton *frb = dbaton->file_rev_baton; struct blame_chain *chain; + apr_time_t wrapped_start_time, start_time; + long wrapped_result_time, result_time; + start_time = apr_time_now(); /* Call the wrapped handler first. */ + wrapped_start_time = apr_time_now(); SVN_ERR(dbaton->wrapped_handler(window, dbaton->wrapped_baton)); + wrapped_result_time = apr_time_now() - wrapped_start_time; + delta_process_time += wrapped_result_time; /* We patiently wait for the NULL window marking the end. */ if (window) + { + result_time = apr_time_now() - start_time; + window_time += result_time; return SVN_NO_ERROR; + } /* Close the files used for the delta. It is important to do this early, since otherwise, they will be deleted @@ -375,6 +406,8 @@ window_handler(svn_txdelta_window_t *window, void frb->currpool = tmp_pool; } + result_time = apr_time_now() - start_time; + window_time += result_time; return SVN_NO_ERROR; } @@ -415,7 +448,10 @@ file_rev_handler(void *baton, const char *path, sv svn_stream_t *cur_stream; struct delta_baton *delta_baton; apr_pool_t *filepool; + apr_time_t start_time; + long result_time; + start_time = apr_time_now(); /* Clear the current pool. */ svn_pool_clear(frb->currpool); @@ -446,7 +482,11 @@ file_rev_handler(void *baton, const char *path, sv since the tempfile will be removed by the pool and we need the tempfile from the last revision with content changes. */ if (!content_delta_handler) + { + result_time = apr_time_now() - start_time; + file_rev_time += result_time; return SVN_NO_ERROR; + } frb->merged_revision = merged_revision; @@ -511,6 +551,8 @@ file_rev_handler(void *baton, const char *path, sv if (frb->include_merged_revisions) frb->rev->path = apr_pstrdup(frb->mainpool, path); + result_time = apr_time_now() - start_time; + file_rev_time += result_time; return SVN_NO_ERROR; } @@ -600,6 +642,8 @@ svn_client_blame5(const char *target, svn_stream_t *last_stream; svn_stream_t *stream; const char *target_abspath_or_url; + apr_time_t starttime; + long result_time; if (start->kind == svn_opt_revision_unspecified || end->kind == svn_opt_revision_unspecified) @@ -666,10 +710,18 @@ svn_client_blame5(const char *target, We need to ensure that we get one revision before the start_rev, if available so that we can know what was actually changed in the start revision. */ + starttime = apr_time_now(); SVN_ERR(svn_ra_get_file_revs2(ra_session, "", start_revnum - (start_revnum > 0 ? 1 : 0), end_revnum, include_merged_revisions, file_rev_handler, &frb, pool)); + result_time = apr_time_now() - starttime; + fprintf(stderr, "### blame took %d usec (%d s)\n", result_time, result_time/1000000L); + fprintf(stderr, "### file_rev_handler: %d (%d s) - window_handler: %d (%d s)\n", + file_rev_time, file_rev_time/1000000L, window_time, window_time/1000000L); + fprintf(stderr, "### wrapped_handler: %d (%d s) - diff: %d (%d s) - blame_process: %d (%d s)\n\n", + delta_process_time, delta_process_time/1000000L, diff_time, diff_time/1000000L, + blame_process_time, blame_process_time/1000000L); if (end->kind == svn_opt_revision_working) {