From: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx> Add trace2_region_enter() and _leave() calls inside read_directory_recursive() to show nesting and per-level timing. TODO Drop this commit or ifdef the calls. It generates too much data to be in the production version. It is included in this patch series for illustration purposes only. It is typical of what a developer might do during a perf investigation. Signed-off-by: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx> --- dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dir.c b/dir.c index aceb0d4869..c7c0654da5 100644 --- a/dir.c +++ b/dir.c @@ -1951,6 +1951,8 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir, strbuf_add(&path, base, baselen); + trace2_region_enter("read_directory_recursive:%.*s", baselen, base); + if (open_cached_dir(&cdir, dir, untracked, istate, &path, check_only)) goto out; @@ -2042,6 +2044,7 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir, close_cached_dir(&cdir); out: strbuf_release(&path); + trace2_region_leave("read_directory_recursive:%.*s", baselen, base); return dir_state; } -- gitgitgadget