git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 0/1] fetch: add trace2 instrumentation

From
EGerik chen via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 18, 2019, 14:52 UTC
Message-ID
<pull.451.v4.git.1574088732.gitgitgadget@gmail.com>
In-Reply-To
<pull.451.v3.git.1573069152.gitgitgadget@gmail.com>

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 [erikchen@chromium.org]
Erik Chen (1):
  fetch: add trace2 instrumentation
 fetch-pack.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
base-commit: d9f6f3b6195a0ca35642561e530798ad1469bd41
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-451%2Ferikchen%2Ftest12-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-451/erikchen/test12-v4
Pull-Request: https://github.com/gitgitgadget/git/pull/451
Range-diff vs v3:
 1:  364c526a5d ! 1:  508d07a3eb fetch: add trace2 instrumentation
     @@ -6,7 +6,9 @@
          phases of a fetch:
      
              * matching common remote and local refs
     -        * marking local refs as complete (part of the matching process)
     +        * parsing remote refs and finding a cutoff
     +        * marking local refs as complete
     +        * marking complete remote refs as common
      
          Both of these stages can be slow for repositories with many refs.
      
     @@ -21,14 +23,28 @@
       
      +	trace2_region_enter("fetch-pack", "mark_complete_and_common_ref", NULL);
      +
     ++	trace2_region_enter("fetch-pack", "parse_remote_refs_and_find_cutoff", NULL);
       	for (ref = *refs; ref; ref = ref->next) {
       		struct object *o;
       
      @@
     + 		if (!o)
     + 			continue;
     + 
     +-		/* We already have it -- which may mean that we were
     ++		/*
     ++		 * We already have it -- which may mean that we were
     + 		 * in sync with the other side at some time after
     + 		 * that (it is OK if we guess wrong here).
     + 		 */
     +@@
     + 				cutoff = commit->date;
       		}
       	}
     ++	trace2_region_leave("fetch-pack", "parse_remote_refs_and_find_cutoff", NULL);
       
     -+	/* This block marks all local refs as COMPLETE, and then recursively marks all
     ++	/*
     ++	 * 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);
     @@ -43,8 +59,17 @@
       
       	/*
       	 * Mark all complete remote refs as common refs.
     + 	 * Don't mark them common yet; the server has to be told so first.
     + 	 */
     ++	trace2_region_enter("fetch-pack", "mark_common_remote_refs", NULL);
     + 	for (ref = *refs; ref; ref = ref->next) {
     + 		struct object *o = deref_tag(the_repository,
     + 					     lookup_object(the_repository,
      @@
     + 		negotiator->known_common(negotiator,
     + 					 (struct commit *)o);
       	}
     ++	trace2_region_leave("fetch-pack", "mark_common_remote_refs", NULL);
       
       	save_commit_buffer = old_save_commit_buffer;
      +	trace2_region_leave("fetch-pack", "mark_complete_and_common_ref", NULL);
-- 
gitgitgadget
Previous: Erik ChenNext: Erik Chen via GitGitGadget
Message 18 of 22 in “fetch: add trace2 instrumentation”
  1. 0/1 fetch: add trace2 instrumentationerik chen via GitGitGadget, Nov 5, 2019
  2. 1/1 fetch: add trace2 instrumentationErik Chen via GitGitGadget, Nov 5, 2019
  3. Johannes SchindelinNov 6, 2019
  4. 0/2 fetch: add trace2 instrumentationerik chen via GitGitGadget, Nov 6, 2019
  5. 1/2 fetch: add trace2 instrumentationErik Chen via GitGitGadget, Nov 6, 2019
  6. 2/2 add whitespaceErik Chen via GitGitGadget, Nov 6, 2019
  7. 0/1 fetch: add trace2 instrumentationerik chen via GitGitGadget, Nov 6, 2019
  8. 1/1 fetch: add trace2 instrumentationErik Chen via GitGitGadget, Nov 6, 2019
  9. Junio C HamanoNov 7, 2019
  10. Derrick StoleeNov 18, 2019
  11. Junio C HamanoNov 19, 2019
  12. Erik ChenNov 19, 2019
  13. Erik ChenNov 19, 2019
  14. Erik ChenNov 19, 2019
  15. Erik ChenNov 19, 2019
  16. Junio C HamanoNov 7, 2019
  17. Erik ChenNov 19, 2019
  18. 0/1 fetch: add trace2 instrumentationerik chen via GitGitGadget, Nov 18, 2019
  19. 1/1 fetch: add trace2 instrumentationErik Chen via GitGitGadget, Nov 18, 2019
  20. 0/1 fetch: add trace2 instrumentationerik chen via GitGitGadget, Nov 19, 2019
  21. 1/1 fetch: add trace2 instrumentationErik Chen via GitGitGadget, Nov 19, 2019
  22. Junio C HamanoNov 20, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.