Skip to content

Commit

Permalink
trace2:gvfs:experiment: add data for check_updates() in unpack_trees()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jeffhostetler authored and dscho committed Aug 16, 2023
1 parent a34ca03 commit edd8df7
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions unpack-trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,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;
Expand All @@ -438,8 +442,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)
Expand All @@ -461,6 +464,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++;
}
}

Expand Down Expand Up @@ -496,6 +500,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)
Expand All @@ -508,6 +513,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;
}
Expand Down Expand Up @@ -1778,10 +1792,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,
Expand Down Expand Up @@ -1905,7 +1918,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();
Expand Down Expand Up @@ -2114,7 +2127,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
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:
Expand Down

0 comments on commit edd8df7

Please sign in to comment.