git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Steadmon <steadmon@google.com>
To: git@vger.kernel.org
Subject: [PATCH 2/2] send-pack: add new tracing regions for push
Date: Thu, 15 Aug 2024 11:51:13 -0700	[thread overview]
Message-ID: <d57f258026f941e7bc05de8dac359fc1e2e42bee.1723747832.git.steadmon@google.com> (raw)
In-Reply-To: <cover.1723747832.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..de8ba46ad5 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -512,8 +512,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 +644,12 @@ 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) {
+		trace2_region_enter("send_pack", "push_cert", the_repository);
 		cmds_sent = generate_push_cert(&req_buf, remote_refs, args,
 					       cap_buf.buf, push_cert_nonce);
-	else if (!args->dry_run)
+		trace2_region_leave("send_pack", "push_cert", the_repository);
+	} else if (!args->dry_run) {
 		for (ref = remote_refs; ref; ref = ref->next) {
 			char *old_hex, *new_hex;
 
@@ -664,6 +669,7 @@ int send_pack(struct send_pack_args *args,
 						 old_hex, new_hex, ref->name);
 			}
 		}
+	}
 
 	if (use_push_options) {
 		struct string_list_item *item;
@@ -686,6 +692,7 @@ int send_pack(struct send_pack_args *args,
 	strbuf_release(&cap_buf);
 
 	if (use_sideband && cmds_sent) {
+		trace2_region_enter("send_pack", "sideband_demux", the_repository);
 		memset(&demux, 0, sizeof(demux));
 		demux.proc = sideband_demux;
 		demux.data = fd;
@@ -719,6 +726,8 @@ int send_pack(struct send_pack_args *args,
 			if (use_sideband) {
 				close(demux.out);
 				finish_async(&demux);
+				if (cmds_sent)
+					trace2_region_leave("send_pack", "sideband_demux", the_repository);
 			}
 			fd[1] = -1;
 			return -1;
@@ -743,6 +752,7 @@ int send_pack(struct send_pack_args *args,
 			error("error in sideband demultiplexer");
 			ret = -1;
 		}
+		trace2_region_leave("send_pack", "sideband_demux", the_repository);
 	}
 
 	if (ret < 0)
-- 
2.46.0.184.g6999bdac58-goog


  parent reply	other threads:[~2024-08-15 18:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-15 18:51 [PATCH 0/2] Add additional trace2 regions for fetch and push Josh Steadmon
2024-08-15 18:51 ` [PATCH 1/2] fetch: add top-level trace2 regions Josh Steadmon
2024-08-15 19:47   ` Junio C Hamano
2024-08-19 18:26     ` Josh Steadmon
2024-08-15 18:51 ` Josh Steadmon [this message]
2024-08-15 20:06   ` [PATCH 2/2] send-pack: add new tracing regions for push Junio C Hamano
2024-08-22 20:20     ` Josh Steadmon
2024-08-22 20:30       ` Junio C Hamano
2024-08-22 21:57 ` [PATCH v2 0/3] Add additional trace2 regions for fetch and push Josh Steadmon
2024-08-22 21:57   ` [PATCH v2 1/3] trace2: implement trace2_printf() for event target Josh Steadmon
2024-08-22 21:57   ` [PATCH v2 2/3] fetch: add top-level trace2 regions Josh Steadmon
2024-08-22 21:57   ` [PATCH v2 3/3] send-pack: add new tracing regions for push Josh Steadmon
2024-08-22 22:10   ` [PATCH v2 0/3] Add additional trace2 regions for fetch and push Junio C Hamano

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

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

  git send-email \
    --in-reply-to=d57f258026f941e7bc05de8dac359fc1e2e42bee.1723747832.git.steadmon@google.com \
    --to=steadmon@google.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).