Skip to content

Commit bf30c8e

Browse files
jeffhostetlermjcheetham
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 <[email protected]> Signed-off-by: Derrick Stolee <[email protected]>
1 parent 9a56222 commit bf30c8e

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
@@ -432,8 +432,12 @@ static int check_updates(struct unpack_trees_options *o,
432432
struct progress *progress;
433433
struct checkout state = CHECKOUT_INIT;
434434
int i, pc_workers, pc_threshold;
435+
intmax_t sum_unlink = 0;
436+
intmax_t sum_prefetch = 0;
437+
intmax_t sum_checkout = 0;
435438

436439
trace_performance_enter();
440+
trace2_region_enter("unpack_trees", "check_updates", NULL);
437441
state.super_prefix = o->super_prefix;
438442
state.force = 1;
439443
state.quiet = 1;
@@ -443,8 +447,7 @@ static int check_updates(struct unpack_trees_options *o,
443447

444448
if (!o->update || o->dry_run) {
445449
remove_marked_cache_entries(index, 0);
446-
trace_performance_leave("check_updates");
447-
return 0;
450+
goto done;
448451
}
449452

450453
if (o->clone)
@@ -466,6 +469,7 @@ static int check_updates(struct unpack_trees_options *o,
466469
if (ce->ce_flags & CE_WT_REMOVE) {
467470
display_progress(progress, ++cnt);
468471
unlink_entry(ce, o->super_prefix);
472+
sum_unlink++;
469473
}
470474
}
471475

@@ -501,6 +505,7 @@ static int check_updates(struct unpack_trees_options *o,
501505

502506
if (last_pc_queue_size == pc_queue_size())
503507
display_progress(progress, ++cnt);
508+
sum_checkout++;
504509
}
505510
}
506511
if (pc_workers > 1)
@@ -513,6 +518,15 @@ static int check_updates(struct unpack_trees_options *o,
513518
if (o->clone)
514519
report_collided_checkout(index);
515520

521+
if (sum_unlink > 0)
522+
trace2_data_intmax("unpack_trees", NULL, "check_updates/nr_unlink", sum_unlink);
523+
if (sum_prefetch > 0)
524+
trace2_data_intmax("unpack_trees", NULL, "check_updates/nr_prefetch", sum_prefetch);
525+
if (sum_checkout > 0)
526+
trace2_data_intmax("unpack_trees", NULL, "check_updates/nr_write", sum_checkout);
527+
528+
done:
529+
trace2_region_leave("unpack_trees", "check_updates", NULL);
516530
trace_performance_leave("check_updates");
517531
return errs != 0;
518532
}
@@ -1791,10 +1805,9 @@ static int clear_ce_flags(struct index_state *istate,
17911805
_("Updating index flags"),
17921806
istate->cache_nr);
17931807

1794-
xsnprintf(label, sizeof(label), "clear_ce_flags(0x%08lx,0x%08lx)",
1808+
xsnprintf(label, sizeof(label), "clear_ce_flags/0x%08lx_0x%08lx",
17951809
(unsigned long)select_mask, (unsigned long)clear_mask);
17961810
trace2_region_enter("unpack_trees", label, the_repository);
1797-
17981811
rval = clear_ce_flags_1(istate,
17991812
istate->cache,
18001813
istate->cache_nr,
@@ -1918,7 +1931,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
19181931
if (o->df_conflict_entry)
19191932
BUG("o->df_conflict_entry is an output only field");
19201933

1921-
trace2_region_enter("exp", "unpack_trees", NULL);
1934+
trace2_region_enter("unpack_trees", "unpack_trees", NULL);
19221935
nr_unpack_entry_at_start = get_nr_unpack_entry();
19231936

19241937
trace_performance_enter();
@@ -2132,7 +2145,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
21322145
trace_performance_leave("unpack_trees");
21332146
trace2_data_intmax("unpack_trees", NULL, "unpack_trees/nr_unpack_entries",
21342147
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
2135-
trace2_region_leave("exp", "unpack_trees", NULL);
2148+
trace2_region_leave("unpack_trees", "unpack_trees", NULL);
21362149
return ret;
21372150

21382151
return_failed:

0 commit comments

Comments
 (0)