summaryrefslogtreecommitdiff
path: root/cache-tree.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-01-04 03:09:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-16 07:04:21 (GMT)
commit4c3e18723cc4ba7a74e067e85831530285f4dd35 (patch)
treef3abf2a4fbdad514ae218900aadbbde83fa97c20 /cache-tree.c
parentfa7ca5d4fe0be77329249954a42a0d1bed5a5aa8 (diff)
downloadgit-4c3e18723cc4ba7a74e067e85831530285f4dd35.zip
git-4c3e18723cc4ba7a74e067e85831530285f4dd35.tar.gz
git-4c3e18723cc4ba7a74e067e85831530285f4dd35.tar.bz2
cache-tree: trace regions for I/O
As we write or read the cache tree index extension, it can be good to isolate how much of the file I/O time is spent constructing this in-memory tree from the existing index or writing it out again to the new index file. Use trace2 regions to indicate that we are spending time on this operation. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache-tree.c')
-rw-r--r--cache-tree.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 9efb674..45fb57b 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -494,7 +494,9 @@ static void write_one(struct strbuf *buffer, struct cache_tree *it,
void cache_tree_write(struct strbuf *sb, struct cache_tree *root)
{
+ trace2_region_enter("cache_tree", "write", the_repository);
write_one(sb, root, "", 0);
+ trace2_region_leave("cache_tree", "write", the_repository);
}
static struct cache_tree *read_one(const char **buffer, unsigned long *size_p)
@@ -583,9 +585,16 @@ static struct cache_tree *read_one(const char **buffer, unsigned long *size_p)
struct cache_tree *cache_tree_read(const char *buffer, unsigned long size)
{
+ struct cache_tree *result;
+
if (buffer[0])
return NULL; /* not the whole tree */
- return read_one(&buffer, &size);
+
+ trace2_region_enter("cache_tree", "read", the_repository);
+ result = read_one(&buffer, &size);
+ trace2_region_leave("cache_tree", "read", the_repository);
+
+ return result;
}
static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *path)