Skip to content

Commit 81e9e7e

Browse files
jeffhostetlervdye
authored andcommitted
trace2:gvfs:experiment: add data for check_updates() in unpack_trees()
Add data for the number of files created/overwritten and deleted during the checkout. Give proper category name to all events in unpack-trees.c and eliminate "exp". This is modified slightly from the original version due to interactions with 26f924d (unpack-trees: exit check_updates() early if updates are not wanted, 2020-01-07). Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
1 parent 27525de commit 81e9e7e

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

unpack-trees.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,12 @@ static int check_updates(struct unpack_trees_options *o,
425425
struct progress *progress;
426426
struct checkout state = CHECKOUT_INIT;
427427
int i, pc_workers, pc_threshold;
428+
intmax_t sum_unlink = 0;
429+
intmax_t sum_prefetch = 0;
430+
intmax_t sum_checkout = 0;
428431

429432
trace_performance_enter();
433+
trace2_region_enter("unpack_trees", "check_updates", NULL);
430434
state.super_prefix = o->super_prefix;
431435
state.force = 1;
432436
state.quiet = 1;
@@ -436,8 +440,7 @@ static int check_updates(struct unpack_trees_options *o,
436440

437441
if (!o->update || o->dry_run) {
438442
remove_marked_cache_entries(index, 0);
439-
trace_performance_leave("check_updates");
440-
return 0;
443+
goto done;
441444
}
442445

443446
if (o->clone)
@@ -459,6 +462,7 @@ static int check_updates(struct unpack_trees_options *o,
459462
if (ce->ce_flags & CE_WT_REMOVE) {
460463
display_progress(progress, ++cnt);
461464
unlink_entry(ce, o->super_prefix);
465+
sum_unlink++;
462466
}
463467
}
464468

@@ -494,6 +498,7 @@ static int check_updates(struct unpack_trees_options *o,
494498

495499
if (last_pc_queue_size == pc_queue_size())
496500
display_progress(progress, ++cnt);
501+
sum_checkout++;
497502
}
498503
}
499504
if (pc_workers > 1)
@@ -506,6 +511,15 @@ static int check_updates(struct unpack_trees_options *o,
506511
if (o->clone)
507512
report_collided_checkout(index);
508513

514+
if (sum_unlink > 0)
515+
trace2_data_intmax("unpack_trees", NULL, "check_updates/nr_unlink", sum_unlink);
516+
if (sum_prefetch > 0)
517+
trace2_data_intmax("unpack_trees", NULL, "check_updates/nr_prefetch", sum_prefetch);
518+
if (sum_checkout > 0)
519+
trace2_data_intmax("unpack_trees", NULL, "check_updates/nr_write", sum_checkout);
520+
521+
done:
522+
trace2_region_leave("unpack_trees", "check_updates", NULL);
509523
trace_performance_leave("check_updates");
510524
return errs != 0;
511525
}
@@ -1776,10 +1790,9 @@ static int clear_ce_flags(struct index_state *istate,
17761790
_("Updating index flags"),
17771791
istate->cache_nr);
17781792

1779-
xsnprintf(label, sizeof(label), "clear_ce_flags(0x%08lx,0x%08lx)",
1793+
xsnprintf(label, sizeof(label), "clear_ce_flags/0x%08lx_0x%08lx",
17801794
(unsigned long)select_mask, (unsigned long)clear_mask);
17811795
trace2_region_enter("unpack_trees", label, the_repository);
1782-
17831796
rval = clear_ce_flags_1(istate,
17841797
istate->cache,
17851798
istate->cache_nr,
@@ -1903,7 +1916,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
19031916
if (o->df_conflict_entry)
19041917
BUG("o->df_conflict_entry is an output only field");
19051918

1906-
trace2_region_enter("exp", "unpack_trees", NULL);
1919+
trace2_region_enter("unpack_trees", "unpack_trees", NULL);
19071920
nr_unpack_entry_at_start = get_nr_unpack_entry();
19081921

19091922
trace_performance_enter();
@@ -2112,7 +2125,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
21122125
trace_performance_leave("unpack_trees");
21132126
trace2_data_intmax("unpack_trees", NULL, "unpack_trees/nr_unpack_entries",
21142127
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
2115-
trace2_region_leave("exp", "unpack_trees", NULL);
2128+
trace2_region_leave("unpack_trees", "unpack_trees", NULL);
21162129
return ret;
21172130

21182131
return_failed:

0 commit comments

Comments
 (0)