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>
Jeff Hostetler committed
Feb 22, 2019 at 14:25 UTC
942b2740ffed773c566e7e4881423b111f98fe93
1 file changed
+22
-2
wt-status.c
+22
-2
@@ -748,12 +748,23 @@ static int has_unmerged(struct wt_status *s)
748
749
void wt_status_collect(struct wt_status *s)
750
{
751
+ trace2_region_enter("status", "worktrees", s->repo);
752
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);
757
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);
761
wt_status_collect_changes_index(s);
762
+ trace2_region_leave("status", "index", s->repo);
763
+ }
764
+
765
+ trace2_region_enter("status", "untracked", s->repo);
766
wt_status_collect_untracked(s);
767
+ trace2_region_leave("status", "untracked", s->repo);
768
769
wt_status_get_state(s->repo, &s->state, s->branch && !strcmp(s->branch, "HEAD"));
770
if (s->state.merge_in_progress && !has_unmerged(s))
@@ -2291,6 +2302,13 @@ static void wt_porcelain_v2_print(struct wt_status *s)
2302
2303
void wt_status_print(struct wt_status *s)
2304
{
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
+
2312
switch (s->status_format) {
2313
case STATUS_FORMAT_SHORT:
2314
wt_shortstatus_print(s);
@@ -2309,6 +2327,8 @@ void wt_status_print(struct wt_status *s)
2327
wt_longstatus_print(s);
2328
break;
2329
}
2330
+
2331
+ trace2_region_leave("status", "print", s->repo);
2332
}
2333
2334
/**