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
@ -518,11 +518,11 @@ static int diff_cache(struct rev_info *revs,
|
||||
int run_diff_index(struct rev_info *revs, int cached)
|
||||
{
|
||||
struct object_array_entry *ent;
|
||||
uint64_t start = getnanotime();
|
||||
|
||||
if (revs->pending.nr != 1)
|
||||
BUG("run_diff_index must be passed exactly one tree");
|
||||
|
||||
trace_performance_enter();
|
||||
ent = revs->pending.objects;
|
||||
if (diff_cache(revs, &ent->item->oid, ent->name, cached))
|
||||
exit(128);
|
||||
@ -531,7 +531,7 @@ int run_diff_index(struct rev_info *revs, int cached)
|
||||
diffcore_fix_diff_index(&revs->diffopt);
|
||||
diffcore_std(&revs->diffopt);
|
||||
diff_flush(&revs->diffopt);
|
||||
trace_performance_since(start, "diff-index");
|
||||
trace_performance_leave("diff-index");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user