@matheusbsbs / matheus-bagliano / commits / e6152e35ff
Fork 0

trace2: add region in clear_ce_flags

When Git updates the working directory with the sparse-checkout feature enabled, the unpack_trees() method calls clear_ce_flags() to update the skip-wortree bits on the cache entries. This check can be expensive, depending on the patterns used. Add trace2 regions around the method, including some flag information, so we can get granular performance data during experiments. This data will be used to measure improvements to the pattern-matching algorithms for sparse-checkout. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff Hostetler committed Nov 21, 2019 at 22:04 UTC e6152e35ff287ab58e2c17065f02cb1be9f4a0aa
1 file changed +9 -1
unpack-trees.c
+9 -1
@@ -1407,15 +1407,23 @@ static int clear_ce_flags(struct index_state *istate,
1407 struct pattern_list *pl)
1408 {
1409 static struct strbuf prefix = STRBUF_INIT;
1410 + char label[100];
1411 + int rval;
1412
1413 strbuf_reset(&prefix);
1414
1413 - return clear_ce_flags_1(istate,
1415 + xsnprintf(label, sizeof(label), "clear_ce_flags(0x%08lx,0x%08lx)",
1416 + (unsigned long)select_mask, (unsigned long)clear_mask);
1417 + trace2_region_enter("unpack_trees", label, the_repository);
1418 + rval = clear_ce_flags_1(istate,
1419 istate->cache,
1420 istate->cache_nr,
1421 &prefix,
1422 select_mask, clear_mask,
1423 pl, 0);
1424 + trace2_region_leave("unpack_trees", label, the_repository);
1425 +
1426 + return rval;
1427 }
1428
1429 /*