зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
5fc31180d8
Коммит
25e4b8099c
|
@ -357,8 +357,10 @@ static int push_with_options(struct transport *transport, struct refspec *rs,
|
||||||
|
|
||||||
if (verbosity > 0)
|
if (verbosity > 0)
|
||||||
fprintf(stderr, _("Pushing to %s\n"), transport->url);
|
fprintf(stderr, _("Pushing to %s\n"), transport->url);
|
||||||
|
trace2_region_enter("push", "transport_push", the_repository);
|
||||||
err = transport_push(the_repository, transport,
|
err = transport_push(the_repository, transport,
|
||||||
rs, flags, &reject_reasons);
|
rs, flags, &reject_reasons);
|
||||||
|
trace2_region_leave("push", "transport_push", the_repository);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
fprintf(stderr, "%s", push_get_color(PUSH_COLOR_ERROR));
|
fprintf(stderr, "%s", push_get_color(PUSH_COLOR_ERROR));
|
||||||
error(_("failed to push some refs to '%s'"), transport->url);
|
error(_("failed to push some refs to '%s'"), transport->url);
|
||||||
|
|
14
transport.c
14
transport.c
|
@ -1145,8 +1145,10 @@ int transport_push(struct repository *r,
|
||||||
|
|
||||||
refspec_ref_prefixes(rs, &ref_prefixes);
|
refspec_ref_prefixes(rs, &ref_prefixes);
|
||||||
|
|
||||||
|
trace2_region_enter("transport_push", "get_refs_list", the_repository);
|
||||||
remote_refs = transport->vtable->get_refs_list(transport, 1,
|
remote_refs = transport->vtable->get_refs_list(transport, 1,
|
||||||
&ref_prefixes);
|
&ref_prefixes);
|
||||||
|
trace2_region_leave("transport_push", "get_refs_list", the_repository);
|
||||||
|
|
||||||
argv_array_clear(&ref_prefixes);
|
argv_array_clear(&ref_prefixes);
|
||||||
|
|
||||||
|
@ -1182,6 +1184,7 @@ int transport_push(struct repository *r,
|
||||||
struct ref *ref = remote_refs;
|
struct ref *ref = remote_refs;
|
||||||
struct oid_array commits = OID_ARRAY_INIT;
|
struct oid_array commits = OID_ARRAY_INIT;
|
||||||
|
|
||||||
|
trace2_region_enter("transport_push", "push_submodules", the_repository);
|
||||||
for (; ref; ref = ref->next)
|
for (; ref; ref = ref->next)
|
||||||
if (!is_null_oid(&ref->new_oid))
|
if (!is_null_oid(&ref->new_oid))
|
||||||
oid_array_append(&commits,
|
oid_array_append(&commits,
|
||||||
|
@ -1194,9 +1197,11 @@ int transport_push(struct repository *r,
|
||||||
transport->push_options,
|
transport->push_options,
|
||||||
pretend)) {
|
pretend)) {
|
||||||
oid_array_clear(&commits);
|
oid_array_clear(&commits);
|
||||||
|
trace2_region_leave("transport_push", "push_submodules", the_repository);
|
||||||
die(_("failed to push all needed submodules"));
|
die(_("failed to push all needed submodules"));
|
||||||
}
|
}
|
||||||
oid_array_clear(&commits);
|
oid_array_clear(&commits);
|
||||||
|
trace2_region_leave("transport_push", "push_submodules", the_repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) ||
|
if (((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) ||
|
||||||
|
@ -1207,6 +1212,7 @@ int transport_push(struct repository *r,
|
||||||
struct string_list needs_pushing = STRING_LIST_INIT_DUP;
|
struct string_list needs_pushing = STRING_LIST_INIT_DUP;
|
||||||
struct oid_array commits = OID_ARRAY_INIT;
|
struct oid_array commits = OID_ARRAY_INIT;
|
||||||
|
|
||||||
|
trace2_region_enter("transport_push", "check_submodules", the_repository);
|
||||||
for (; ref; ref = ref->next)
|
for (; ref; ref = ref->next)
|
||||||
if (!is_null_oid(&ref->new_oid))
|
if (!is_null_oid(&ref->new_oid))
|
||||||
oid_array_append(&commits,
|
oid_array_append(&commits,
|
||||||
|
@ -1217,15 +1223,19 @@ int transport_push(struct repository *r,
|
||||||
transport->remote->name,
|
transport->remote->name,
|
||||||
&needs_pushing)) {
|
&needs_pushing)) {
|
||||||
oid_array_clear(&commits);
|
oid_array_clear(&commits);
|
||||||
|
trace2_region_leave("transport_push", "check_submodules", the_repository);
|
||||||
die_with_unpushed_submodules(&needs_pushing);
|
die_with_unpushed_submodules(&needs_pushing);
|
||||||
}
|
}
|
||||||
string_list_clear(&needs_pushing, 0);
|
string_list_clear(&needs_pushing, 0);
|
||||||
oid_array_clear(&commits);
|
oid_array_clear(&commits);
|
||||||
|
trace2_region_leave("transport_push", "check_submodules", the_repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & TRANSPORT_RECURSE_SUBMODULES_ONLY))
|
if (!(flags & TRANSPORT_RECURSE_SUBMODULES_ONLY)) {
|
||||||
|
trace2_region_enter("transport_push", "push_refs", the_repository);
|
||||||
push_ret = transport->vtable->push_refs(transport, remote_refs, flags);
|
push_ret = transport->vtable->push_refs(transport, remote_refs, flags);
|
||||||
else
|
trace2_region_leave("transport_push", "push_refs", the_repository);
|
||||||
|
} else
|
||||||
push_ret = 0;
|
push_ret = 0;
|
||||||
err = push_had_errors(remote_refs);
|
err = push_had_errors(remote_refs);
|
||||||
ret = push_ret | err;
|
ret = push_ret | err;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче