summary refs log tree commit diff
path: root/name-hash.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-01-23 19:58:16 +0000
committerJunio C Hamano <gitster@pobox.com>2021-01-23 17:14:07 -0800
commit6a9372f4ef218d189120e969f6dc01f9fcd5317a (patch)
treeacba06fae0bfc1b0f515c92a4e815a2ec48f6c4d /name-hash.c
parent1fd9ae517c45294a01466aad0d38f99c7893d814 (diff)
name-hash: use trace2 regions for init
The lazy_init_name_hash() populates a hashset with all filenames and
another with all directories represented in the index. This is run only
if we need to use the hashsets to check for existence or case-folding
renames.

Place trace2 regions where there is already a performance trace.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'name-hash.c')
-rw-r--r--name-hash.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/name-hash.c b/name-hash.c
index 5d3c7b12c1..4e03fac9bb 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -7,6 +7,7 @@
  */
 #include "cache.h"
 #include "thread-utils.h"
+#include "trace2.h"
 
 struct dir_entry {
 	struct hashmap_entry ent;
@@ -577,6 +578,7 @@ static void lazy_init_name_hash(struct index_state *istate)
 	if (istate->name_hash_initialized)
 		return;
 	trace_performance_enter();
+	trace2_region_enter("index", "name-hash-init", istate->repo);
 	hashmap_init(&istate->name_hash, cache_entry_cmp, NULL, istate->cache_nr);
 	hashmap_init(&istate->dir_hash, dir_entry_cmp, NULL, istate->cache_nr);
 
@@ -597,6 +599,7 @@ static void lazy_init_name_hash(struct index_state *istate)
 	}
 
 	istate->name_hash_initialized = 1;
+	trace2_region_leave("index", "name-hash-init", istate->repo);
 	trace_performance_leave("initialize name hash");
 }