Skip to content

Commit 942b274

Browse files
jeffhostetlergitster
authored andcommitted
trace2:data: add trace2 regions to wt-status
Add trace2_region_enter() and trace2_region_leave() calls around the various phases of a status scan. This gives elapsed time for each phase in the GIT_TR2_PERF and GIT_TR2_EVENT trace target. Also, these Trace2 calls now use s->repo rather than the_repository. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 353d3d7 commit 942b274

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

wt-status.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,12 +748,23 @@ static int has_unmerged(struct wt_status *s)
748748

749749
void wt_status_collect(struct wt_status *s)
750750
{
751+
trace2_region_enter("status", "worktrees", s->repo);
751752
wt_status_collect_changes_worktree(s);
752-
if (s->is_initial)
753+
trace2_region_leave("status", "worktrees", s->repo);
754+
755+
if (s->is_initial) {
756+
trace2_region_enter("status", "initial", s->repo);
753757
wt_status_collect_changes_initial(s);
754-
else
758+
trace2_region_leave("status", "initial", s->repo);
759+
} else {
760+
trace2_region_enter("status", "index", s->repo);
755761
wt_status_collect_changes_index(s);
762+
trace2_region_leave("status", "index", s->repo);
763+
}
764+
765+
trace2_region_enter("status", "untracked", s->repo);
756766
wt_status_collect_untracked(s);
767+
trace2_region_leave("status", "untracked", s->repo);
757768

758769
wt_status_get_state(s->repo, &s->state, s->branch && !strcmp(s->branch, "HEAD"));
759770
if (s->state.merge_in_progress && !has_unmerged(s))
@@ -2291,6 +2302,13 @@ static void wt_porcelain_v2_print(struct wt_status *s)
22912302

22922303
void wt_status_print(struct wt_status *s)
22932304
{
2305+
trace2_data_intmax("status", s->repo, "count/changed", s->change.nr);
2306+
trace2_data_intmax("status", s->repo, "count/untracked",
2307+
s->untracked.nr);
2308+
trace2_data_intmax("status", s->repo, "count/ignored", s->ignored.nr);
2309+
2310+
trace2_region_enter("status", "print", s->repo);
2311+
22942312
switch (s->status_format) {
22952313
case STATUS_FORMAT_SHORT:
22962314
wt_shortstatus_print(s);
@@ -2309,6 +2327,8 @@ void wt_status_print(struct wt_status *s)
23092327
wt_longstatus_print(s);
23102328
break;
23112329
}
2330+
2331+
trace2_region_leave("status", "print", s->repo);
23122332
}
23132333

23142334
/**

0 commit comments

Comments
 (0)