git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Erik Chen via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Erik Chen <erikchen@chromium.org>
Subject: [PATCH v2 1/2] fetch: add trace2 instrumentation
Date: Wed, 06 Nov 2019 18:51:39 +0000	[thread overview]
Message-ID: <4fdbb9f504ee59e508b7df520f7890e29fbca7df.1573066300.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.451.v2.git.1573066300.gitgitgadget@gmail.com>

From: Erik Chen <erikchen@chromium.org>

Add trace2 regions to fetch-pack.c to better track time spent in the various
phases of a fetch:

    * matching common remote and local refs
    * marking local refs as complete (part of the matching process)

Both of these stages can be slow for repositories with many refs.

Signed-off-by: Erik Chen <erikchen@chromium.org>
---
 fetch-pack.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fetch-pack.c b/fetch-pack.c
index 0130b44112..f2f3365bbe 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -666,9 +666,10 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
 	struct ref *ref;
 	int old_save_commit_buffer = save_commit_buffer;
 	timestamp_t cutoff = 0;
-
 	save_commit_buffer = 0;
 
+	trace2_region_enter("fetch-pack", "mark_complete_and_common_ref", NULL);
+
 	for (ref = *refs; ref; ref = ref->next) {
 		struct object *o;
 
@@ -690,6 +691,10 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
 		}
 	}
 
+	/* This block marks all local refs as COMPLETE, and then recursively marks all
+	 * parents of those refs as COMPLETE.
+	 */
+	trace2_region_enter("fetch-pack", "mark_complete_local_refs", NULL);
 	if (!args->deepen) {
 		for_each_ref(mark_complete_oid, NULL);
 		for_each_cached_alternate(NULL, mark_alternate_complete);
@@ -697,6 +702,7 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
 		if (cutoff)
 			mark_recent_complete_commits(args, cutoff);
 	}
+	trace2_region_leave("fetch-pack", "mark_complete_local_refs", NULL);
 
 	/*
 	 * Mark all complete remote refs as common refs.
@@ -716,6 +722,7 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
 	}
 
 	save_commit_buffer = old_save_commit_buffer;
+	trace2_region_leave("fetch-pack", "mark_complete_and_common_ref", NULL);
 }
 
 /*
-- 
gitgitgadget


  reply	other threads:[~2019-11-06 18:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 19:26 [PATCH 0/1] fetch: add trace2 instrumentation erik chen via GitGitGadget
2019-11-05 19:26 ` [PATCH 1/1] " Erik Chen via GitGitGadget
2019-11-06 12:30   ` Johannes Schindelin
2019-11-06 18:51 ` [PATCH v2 0/2] " erik chen via GitGitGadget
2019-11-06 18:51   ` Erik Chen via GitGitGadget [this message]
2019-11-06 18:51   ` [PATCH v2 2/2] add whitespace Erik Chen via GitGitGadget
2019-11-06 19:39   ` [PATCH v3 0/1] fetch: add trace2 instrumentation erik chen via GitGitGadget
2019-11-06 19:39     ` [PATCH v3 1/1] " Erik Chen via GitGitGadget
2019-11-07  5:32       ` Junio C Hamano
2019-11-18 15:46         ` Derrick Stolee
2019-11-19  1:55           ` Junio C Hamano
2019-11-19 21:24             ` Erik Chen
2019-11-19 22:57             ` Erik Chen
2019-11-19 21:51           ` Erik Chen
2019-11-19 21:47         ` Erik Chen
2019-11-07  5:21     ` [PATCH v3 0/1] " Junio C Hamano
2019-11-19 21:44       ` Erik Chen
2019-11-18 14:52     ` [PATCH v4 " erik chen via GitGitGadget
2019-11-18 14:52       ` [PATCH v4 1/1] " Erik Chen via GitGitGadget
2019-11-19 23:02       ` [PATCH v5 0/1] " erik chen via GitGitGadget
2019-11-19 23:02         ` [PATCH v5 1/1] " Erik Chen via GitGitGadget
2019-11-20  1:07           ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2019-10-02 23:49 [PATCH 0/2] add trace2 regions to fetch & push Josh Steadmon
2019-10-07 22:35 ` [PATCH v2 " Josh Steadmon
2019-10-07 22:35   ` [PATCH v2 1/2] fetch: add trace2 instrumentation Josh Steadmon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4fdbb9f504ee59e508b7df520f7890e29fbca7df.1573066300.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=erikchen@chromium.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).