]> git.ipfire.org Git - thirdparty/git.git/commitdiff
trace2: add region in clear_ce_flags
authorJeff Hostetler <jeffhost@microsoft.com>
Thu, 21 Nov 2019 22:04:39 +0000 (22:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Nov 2019 07:11:44 +0000 (16:11 +0900)
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>
unpack-trees.c

index 33ea7810d8cfbb819fcfc76ca8e71aa03c66f3be..01a05ff66dda8b2c700338b6900421350fdf9d57 100644 (file)
@@ -1407,15 +1407,23 @@ static int clear_ce_flags(struct index_state *istate,
                          struct pattern_list *pl)
 {
        static struct strbuf prefix = STRBUF_INIT;
+       char label[100];
+       int rval;
 
        strbuf_reset(&prefix);
 
-       return clear_ce_flags_1(istate,
+       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,
                                &prefix,
                                select_mask, clear_mask,
                                pl, 0);
+       trace2_region_leave("unpack_trees", label, the_repository);
+
+       return rval;
 }
 
 /*