]> git.ipfire.org Git - thirdparty/git.git/commitdiff
cache-tree: trace regions for prime_cache_tree
authorDerrick Stolee <dstolee@microsoft.com>
Mon, 4 Jan 2021 03:09:14 +0000 (03:09 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 16 Jan 2021 07:04:32 +0000 (23:04 -0800)
Commands such as "git reset --hard" rebuild the in-memory representation
of the cache tree index extension by parsing tree objects starting at a
known root tree. The performance of this operation can vary widely
depending on the width and depth of the repository's working directory
structure. Measure the time in this operation using trace2 regions in
prime_cache_tree().

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache-tree.c

index 45fb57b17f3befcd7e9a5bf028cbf11bd8229138..7da59b2aa0737adb73176e0c3b68d04395c9dd75 100644 (file)
@@ -744,10 +744,13 @@ void prime_cache_tree(struct repository *r,
                      struct index_state *istate,
                      struct tree *tree)
 {
+       trace2_region_enter("cache-tree", "prime_cache_tree", the_repository);
        cache_tree_free(&istate->cache_tree);
        istate->cache_tree = cache_tree();
+
        prime_cache_tree_rec(r, istate->cache_tree, tree);
        istate->cache_changed |= CACHE_TREE_CHANGED;
+       trace2_region_leave("cache-tree", "prime_cache_tree", the_repository);
 }
 
 /*