push: add trace2 instrumentation
Add trace2 regions in transport.c and builtin/push.c to better track time spent in various phases of pushing: * Listing refs * Checking submodules * Pushing submodules * Pushing refs Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Josh Steadmon committed
Oct 2, 2019 at 16:49 UTC
25e4b8099c0ed4c2b4eeb3c8a7edce3785d9aeab
2 files changed
+14
-2
builtin/push.c
+2
@@ -357,8 +357,10 @@ static int push_with_options(struct transport *transport, struct refspec *rs,
357
358
if (verbosity > 0)
359
fprintf(stderr, _("Pushing to %s\n"), transport->url);
360
+ trace2_region_enter("push", "transport_push", the_repository);
361
err = transport_push(the_repository, transport,
362
rs, flags, &reject_reasons);
363
+ trace2_region_leave("push", "transport_push", the_repository);
364
if (err != 0) {
365
fprintf(stderr, "%s", push_get_color(PUSH_COLOR_ERROR));
366
error(_("failed to push some refs to '%s'"), transport->url);
transport.c
+12
-2
@@ -1145,8 +1145,10 @@ int transport_push(struct repository *r,
1145
1146
refspec_ref_prefixes(rs, &ref_prefixes);
1147
1148
+ trace2_region_enter("transport_push", "get_refs_list", the_repository);
1149
remote_refs = transport->vtable->get_refs_list(transport, 1,
1150
&ref_prefixes);
1151
+ trace2_region_leave("transport_push", "get_refs_list", the_repository);
1152
1153
argv_array_clear(&ref_prefixes);
1154
@@ -1182,6 +1184,7 @@ int transport_push(struct repository *r,
1184
struct ref *ref = remote_refs;
1185
struct oid_array commits = OID_ARRAY_INIT;
1186
1187
+ trace2_region_enter("transport_push", "push_submodules", the_repository);
1188
for (; ref; ref = ref->next)
1189
if (!is_null_oid(&ref->new_oid))
1190
oid_array_append(&commits,
@@ -1194,9 +1197,11 @@ int transport_push(struct repository *r,
1197
transport->push_options,
1198
pretend)) {
1199
oid_array_clear(&commits);
1200
+ trace2_region_leave("transport_push", "push_submodules", the_repository);
1201
die(_("failed to push all needed submodules"));
1202
}
1203
oid_array_clear(&commits);
1204
+ trace2_region_leave("transport_push", "push_submodules", the_repository);
1205
}
1206
1207
if (((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) ||
@@ -1207,6 +1212,7 @@ int transport_push(struct repository *r,
1212
struct string_list needs_pushing = STRING_LIST_INIT_DUP;
1213
struct oid_array commits = OID_ARRAY_INIT;
1214
1215
+ trace2_region_enter("transport_push", "check_submodules", the_repository);
1216
for (; ref; ref = ref->next)
1217
if (!is_null_oid(&ref->new_oid))
1218
oid_array_append(&commits,
@@ -1217,15 +1223,19 @@ int transport_push(struct repository *r,
1223
transport->remote->name,
1224
&needs_pushing)) {
1225
oid_array_clear(&commits);
1226
+ trace2_region_leave("transport_push", "check_submodules", the_repository);
1227
die_with_unpushed_submodules(&needs_pushing);
1228
}
1229
string_list_clear(&needs_pushing, 0);
1230
oid_array_clear(&commits);
1231
+ trace2_region_leave("transport_push", "check_submodules", the_repository);
1232
}
1233
1226
- if (!(flags & TRANSPORT_RECURSE_SUBMODULES_ONLY))
1234
+ if (!(flags & TRANSPORT_RECURSE_SUBMODULES_ONLY)) {
1235
+ trace2_region_enter("transport_push", "push_refs", the_repository);
1236
push_ret = transport->vtable->push_refs(transport, remote_refs, flags);
1228
- else
1237
+ trace2_region_leave("transport_push", "push_refs", the_repository);
1238
+ } else
1239
push_ret = 0;
1240
err = push_had_errors(remote_refs);
1241
ret = push_ret | err;