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

[PATCH v2 3/3] send-pack: add new tracing regions for push

From
Josh Steadmon <steadmon@google.com>
Date
Aug 22, 2024, 21:57 UTC
Message-ID
<1927bb5b1f8c6486d49013fb216c4cd672fcfbc5.1724363615.git.steadmon@google.com>
In-Reply-To
<cover.1724363615.git.steadmon@google.com>
From: Calvin Wan <calvinwan@google.com>

At $DAYJOB we experienced some slow pushes and needed additional trace data to diagnose them.

Add trace2 regions for various sections of send_pack().
Signed-off-by: Josh Steadmon <steadmon@google.com>
---
 send-pack.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/send-pack.c b/send-pack.c
index fa2f5eec17..9666b2c995 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -75,6 +75,7 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,
 	int i;
 	int rc;
 
+	trace2_region_enter("send_pack", "pack_objects", the_repository);
 	strvec_push(&po.args, "pack-objects");
 	strvec_push(&po.args, "--all-progress-implied");
 	strvec_push(&po.args, "--revs");
@@ -146,8 +147,10 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,
 		 */
 		if (rc > 128 && rc != 141)
 			error("pack-objects died of signal %d", rc - 128);
+		trace2_region_leave("send_pack", "pack_objects", the_repository);
 		return -1;
 	}
+	trace2_region_leave("send_pack", "pack_objects", the_repository);
 	return 0;
 }
 
@@ -170,6 +173,7 @@ static int receive_status(struct packet_reader *reader, struct ref *refs)
 	int new_report = 0;
 	int once = 0;
 
+	trace2_region_enter("send_pack", "receive_status", the_repository);
 	hint = NULL;
 	ret = receive_unpack_status(reader);
 	while (1) {
@@ -268,6 +272,7 @@ static int receive_status(struct packet_reader *reader, struct ref *refs)
 			new_report = 1;
 		}
 	}
+	trace2_region_leave("send_pack", "receive_status", the_repository);
 	return ret;
 }
 
@@ -512,8 +517,11 @@ int send_pack(struct send_pack_args *args,
 	}
 
 	git_config_get_bool("push.negotiate", &push_negotiate);
-	if (push_negotiate)
+	if (push_negotiate) {
+		trace2_region_enter("send_pack", "push_negotiate", the_repository);
 		get_commons_through_negotiation(args->url, remote_refs, &commons);
+		trace2_region_leave("send_pack", "push_negotiate", the_repository);
+	}
 
 	if (!git_config_get_bool("push.usebitmaps", &use_bitmaps))
 		args->disable_bitmaps = !use_bitmaps;
@@ -641,10 +649,11 @@ int send_pack(struct send_pack_args *args,
 	/*
 	 * Finally, tell the other end!
 	 */
-	if (!args->dry_run && push_cert_nonce)
+	if (!args->dry_run && push_cert_nonce) {
 		cmds_sent = generate_push_cert(&req_buf, remote_refs, args,
 					       cap_buf.buf, push_cert_nonce);
-	else if (!args->dry_run)
+		trace2_printf("Generated push certificate");
+	} else if (!args->dry_run) {
 		for (ref = remote_refs; ref; ref = ref->next) {
 			char *old_hex, *new_hex;
 
@@ -664,6 +673,7 @@ int send_pack(struct send_pack_args *args,
 						 old_hex, new_hex, ref->name);
 			}
 		}
+	}
 
 	if (use_push_options) {
 		struct string_list_item *item;
-- 
2.46.0.295.g3b9ea8a38a-goog
Previous: Josh SteadmonNext: Junio C Hamano
Message 12 of 13 in “Add additional trace2 regions for fetch and push”
  1. 0/2 Add additional trace2 regions for fetch and pushJosh Steadmon, Aug 15, 2024
  2. 1/2 fetch: add top-level trace2 regionsJosh Steadmon, Aug 15, 2024
  3. Junio C HamanoAug 15, 2024
  4. Josh SteadmonAug 19, 2024
  5. 2/2 send-pack: add new tracing regions for pushJosh Steadmon, Aug 15, 2024
  6. Junio C HamanoAug 15, 2024
  7. Josh SteadmonAug 22, 2024
  8. Junio C HamanoAug 22, 2024
  9. 0/3 Add additional trace2 regions for fetch and pushJosh Steadmon, Aug 22, 2024
  10. 1/3 trace2: implement trace2_printf() for event targetJosh Steadmon, Aug 22, 2024
  11. 2/3 fetch: add top-level trace2 regionsJosh Steadmon, Aug 22, 2024
  12. 3/3 send-pack: add new tracing regions for pushJosh Steadmon, Aug 22, 2024
  13. Junio C HamanoAug 22, 2024

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.