trace.h: support nested performance tracing
Performance measurements are listed right now as a flat list, which is fine when we measure big blocks. But when we start adding more and more measurements, some of them could be just part of a bigger measurement and a flat list gives a wrong impression that they are executed at the same level instead of nested. Add trace_performance_enter() and trace_performance_leave() to allow indent these nested measurements. For now it does not help much because the only nested thing is (lazy) name hash initialization (e.g. called in diff-index from "git status"). This will help more because I'm going to add some more tracing that's actually nested. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
fa03cdc39b
commit
c46c406ae1
@ -578,10 +578,10 @@ static void threaded_lazy_init_name_hash(
|
||||
|
||||
static void lazy_init_name_hash(struct index_state *istate)
|
||||
{
|
||||
uint64_t start = getnanotime();
|
||||
|
||||
if (istate->name_hash_initialized)
|
||||
return;
|
||||
trace_performance_enter();
|
||||
hashmap_init(&istate->name_hash, cache_entry_cmp, NULL, istate->cache_nr);
|
||||
hashmap_init(&istate->dir_hash, dir_entry_cmp, NULL, istate->cache_nr);
|
||||
|
||||
@ -602,7 +602,7 @@ static void lazy_init_name_hash(struct index_state *istate)
|
||||
}
|
||||
|
||||
istate->name_hash_initialized = 1;
|
||||
trace_performance_since(start, "initialize name hash");
|
||||
trace_performance_leave("initialize name hash");
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user