@@ -2440,6 +2440,7 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
if (open_cached_dir(&cdir, dir, untracked, istate, &path, check_only))
goto out;
+ dir->visited_directories++;
if (untracked)
untracked->check_only = !!check_only;
@@ -2448,6 +2449,7 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
/* check how the file or directory should be treated */
state = treat_path(dir, untracked, &cdir, istate, &path,
baselen, pathspec);
+ dir->visited_paths++;
if (state > dir_state)
dir_state = state;
@@ -2763,6 +2765,10 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
static void trace2_read_directory_statistics(struct dir_struct *dir,
struct repository *repo)
{
+ trace2_data_intmax("read_directory", repo,
+ "directories-visited", dir->visited_directories);
+ trace2_data_intmax("read_directory", repo,
+ "paths-visited", dir->visited_paths);
if (!dir->untracked)
return;
trace2_data_intmax("read_directory", repo,
@@ -2783,6 +2789,8 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,
struct untracked_cache_dir *untracked;
trace2_region_enter("dir", "read_directory", istate->repo);
+ dir->visited_paths = 0;
+ dir->visited_directories = 0;
if (has_symlink_leading_path(path, len)) {
trace_performance_leave("read directory %.*s", len, path);
@@ -336,6 +336,10 @@ struct dir_struct {
struct oid_stat ss_info_exclude;
struct oid_stat ss_excludes_file;
unsigned unmanaged_exclude_files;
+
+ /* Stats about the traversal */
+ unsigned visited_paths;
+ unsigned visited_directories;
};
/*Count the number of slashes for string s*/
@@ -65,6 +65,7 @@ get_relevant_traces() {
INPUT_FILE=$1
OUTPUT_FILE=$2
grep data.*read_directo $INPUT_FILE \
+ | grep -v visited \
| cut -d "|" -f 9 \
>$OUTPUT_FILE
}