Skip to content

Commit 3ccceea

Browse files
jeffhostetlerdscho
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 a5e0b36 commit 3ccceea

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

435438
trace_performance_enter();
439+
trace2_region_enter("unpack_trees", "check_updates", NULL);
436440
state.super_prefix = o->super_prefix;
437441
state.force = 1;
438442
state.quiet = 1;
@@ -442,8 +446,7 @@ static int check_updates(struct unpack_trees_options *o,
442446

443447
if (!o->update || o->dry_run) {
444448
remove_marked_cache_entries(index, 0);
445-
trace_performance_leave("check_updates");
446-
return 0;
449+
goto done;
447450
}
448451

449452
if (o->clone)
@@ -465,6 +468,7 @@ static int check_updates(struct unpack_trees_options *o,
465468
if (ce->ce_flags & CE_WT_REMOVE) {
466469
display_progress(progress, ++cnt);
467470
unlink_entry(ce, o->super_prefix);
471+
sum_unlink++;
468472
}
469473
}
470474

@@ -500,6 +504,7 @@ static int check_updates(struct unpack_trees_options *o,
500504

501505
if (last_pc_queue_size == pc_queue_size())
502506
display_progress(progress, ++cnt);
507+
sum_checkout++;
503508
}
504509
}
505510
if (pc_workers > 1)
@@ -512,6 +517,15 @@ static int check_updates(struct unpack_trees_options *o,
512517
if (o->clone)
513518
report_collided_checkout(index);
514519

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

1792-
xsnprintf(label, sizeof(label), "clear_ce_flags(0x%08lx,0x%08lx)",
1806+
xsnprintf(label, sizeof(label), "clear_ce_flags/0x%08lx_0x%08lx",
17931807
(unsigned long)select_mask, (unsigned long)clear_mask);
17941808
trace2_region_enter("unpack_trees", label, the_repository);
1795-
17961809
rval = clear_ce_flags_1(istate,
17971810
istate->cache,
17981811
istate->cache_nr,
@@ -1916,7 +1929,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
19161929
if (o->df_conflict_entry)
19171930
BUG("o->df_conflict_entry is an output only field");
19181931

1919-
trace2_region_enter("exp", "unpack_trees", NULL);
1932+
trace2_region_enter("unpack_trees", "unpack_trees", NULL);
19201933
nr_unpack_entry_at_start = get_nr_unpack_entry();
19211934

19221935
trace_performance_enter();
@@ -2130,7 +2143,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
21302143
trace_performance_leave("unpack_trees");
21312144
trace2_data_intmax("unpack_trees", NULL, "unpack_trees/nr_unpack_entries",
21322145
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
2133-
trace2_region_leave("exp", "unpack_trees", NULL);
2146+
trace2_region_leave("unpack_trees", "unpack_trees", NULL);
21342147
return ret;
21352148

21362149
return_failed:

0 commit comments

Comments
 (0)