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>
This commit is contained in:
Jeff Hostetler 2019-07-25 14:52:33 -04:00 коммит произвёл Victoria Dye
Родитель 025c5b1700
Коммит 1611c07e7a
1 изменённых файлов: 19 добавлений и 6 удалений

Просмотреть файл

@ -425,8 +425,12 @@ static int check_updates(struct unpack_trees_options *o,
struct progress *progress;
struct checkout state = CHECKOUT_INIT;
int i, pc_workers, pc_threshold;
intmax_t sum_unlink = 0;
intmax_t sum_prefetch = 0;
intmax_t sum_checkout = 0;
trace_performance_enter();
trace2_region_enter("unpack_trees", "check_updates", NULL);
state.super_prefix = o->super_prefix;
state.force = 1;
state.quiet = 1;
@ -436,8 +440,7 @@ static int check_updates(struct unpack_trees_options *o,
if (!o->update || o->dry_run) {
remove_marked_cache_entries(index, 0);
trace_performance_leave("check_updates");
return 0;
goto done;
}
if (o->clone)
@ -459,6 +462,7 @@ static int check_updates(struct unpack_trees_options *o,
if (ce->ce_flags & CE_WT_REMOVE) {
display_progress(progress, ++cnt);
unlink_entry(ce, o->super_prefix);
sum_unlink++;
}
}
@ -494,6 +498,7 @@ static int check_updates(struct unpack_trees_options *o,
if (last_pc_queue_size == pc_queue_size())
display_progress(progress, ++cnt);
sum_checkout++;
}
}
if (pc_workers > 1)
@ -506,6 +511,15 @@ static int check_updates(struct unpack_trees_options *o,
if (o->clone)
report_collided_checkout(index);
if (sum_unlink > 0)
trace2_data_intmax("unpack_trees", NULL, "check_updates/nr_unlink", sum_unlink);
if (sum_prefetch > 0)
trace2_data_intmax("unpack_trees", NULL, "check_updates/nr_prefetch", sum_prefetch);
if (sum_checkout > 0)
trace2_data_intmax("unpack_trees", NULL, "check_updates/nr_write", sum_checkout);
done:
trace2_region_leave("unpack_trees", "check_updates", NULL);
trace_performance_leave("check_updates");
return errs != 0;
}
@ -1776,10 +1790,9 @@ static int clear_ce_flags(struct index_state *istate,
_("Updating index flags"),
istate->cache_nr);
xsnprintf(label, sizeof(label), "clear_ce_flags(0x%08lx,0x%08lx)",
xsnprintf(label, sizeof(label), "clear_ce_flags/0x%08lx_0x%08lx",
(unsigned long)select_mask, (unsigned long)clear_mask);
trace2_region_enter("unpack_trees", label, the_repository);
rval = clear_ce_flags_1(istate,
istate->cache,
istate->cache_nr,
@ -1903,7 +1916,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
if (o->df_conflict_entry)
BUG("o->df_conflict_entry is an output only field");
trace2_region_enter("exp", "unpack_trees", NULL);
trace2_region_enter("unpack_trees", "unpack_trees", NULL);
nr_unpack_entry_at_start = get_nr_unpack_entry();
trace_performance_enter();
@ -2112,7 +2125,7 @@ done:
trace_performance_leave("unpack_trees");
trace2_data_intmax("unpack_trees", NULL, "unpack_trees/nr_unpack_entries",
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
trace2_region_leave("exp", "unpack_trees", NULL);
trace2_region_leave("unpack_trees", "unpack_trees", NULL);
return ret;
return_failed: