Skip to content

Commit db52812

Browse files
calvin-wan-googlegitster
authored andcommitted
send-pack: add new tracing regions for push
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent a45ab54 commit db52812

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

send-pack.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,
7575
int i;
7676
int rc;
7777

78+
trace2_region_enter("send_pack", "pack_objects", the_repository);
7879
strvec_push(&po.args, "pack-objects");
7980
strvec_push(&po.args, "--all-progress-implied");
8081
strvec_push(&po.args, "--revs");
@@ -146,8 +147,10 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,
146147
*/
147148
if (rc > 128 && rc != 141)
148149
error("pack-objects died of signal %d", rc - 128);
150+
trace2_region_leave("send_pack", "pack_objects", the_repository);
149151
return -1;
150152
}
153+
trace2_region_leave("send_pack", "pack_objects", the_repository);
151154
return 0;
152155
}
153156

@@ -170,6 +173,7 @@ static int receive_status(struct packet_reader *reader, struct ref *refs)
170173
int new_report = 0;
171174
int once = 0;
172175

176+
trace2_region_enter("send_pack", "receive_status", the_repository);
173177
hint = NULL;
174178
ret = receive_unpack_status(reader);
175179
while (1) {
@@ -268,6 +272,7 @@ static int receive_status(struct packet_reader *reader, struct ref *refs)
268272
new_report = 1;
269273
}
270274
}
275+
trace2_region_leave("send_pack", "receive_status", the_repository);
271276
return ret;
272277
}
273278

@@ -512,8 +517,11 @@ int send_pack(struct send_pack_args *args,
512517
}
513518

514519
git_config_get_bool("push.negotiate", &push_negotiate);
515-
if (push_negotiate)
520+
if (push_negotiate) {
521+
trace2_region_enter("send_pack", "push_negotiate", the_repository);
516522
get_commons_through_negotiation(args->url, remote_refs, &commons);
523+
trace2_region_leave("send_pack", "push_negotiate", the_repository);
524+
}
517525

518526
if (!git_config_get_bool("push.usebitmaps", &use_bitmaps))
519527
args->disable_bitmaps = !use_bitmaps;
@@ -641,10 +649,11 @@ int send_pack(struct send_pack_args *args,
641649
/*
642650
* Finally, tell the other end!
643651
*/
644-
if (!args->dry_run && push_cert_nonce)
652+
if (!args->dry_run && push_cert_nonce) {
645653
cmds_sent = generate_push_cert(&req_buf, remote_refs, args,
646654
cap_buf.buf, push_cert_nonce);
647-
else if (!args->dry_run)
655+
trace2_printf("Generated push certificate");
656+
} else if (!args->dry_run) {
648657
for (ref = remote_refs; ref; ref = ref->next) {
649658
char *old_hex, *new_hex;
650659

@@ -664,6 +673,7 @@ int send_pack(struct send_pack_args *args,
664673
old_hex, new_hex, ref->name);
665674
}
666675
}
676+
}
667677

668678
if (use_push_options) {
669679
struct string_list_item *item;

0 commit comments

Comments
 (0)