gvfs:trace2:data: add vfs stats

Report virtual filesystem summary data.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
This commit is contained in:
Jeff Hostetler 2018-11-19 16:26:37 -05:00 коммит произвёл Derrick Stolee
Родитель 13a32d2ec1
Коммит 2f67571a79
1 изменённых файлов: 35 добавлений и 2 удалений

Просмотреть файл

@ -254,6 +254,11 @@ void apply_virtualfilesystem(struct index_state *istate)
{ {
char *buf, *entry; char *buf, *entry;
int i; int i;
int nr_unknown = 0;
int nr_vfs_dirs = 0;
int nr_vfs_rows = 0;
int nr_bulk_skip = 0;
int nr_explicit_skip = 0;
if (!git_config_get_virtualfilesystem()) if (!git_config_get_virtualfilesystem())
return; return;
@ -271,16 +276,21 @@ void apply_virtualfilesystem(struct index_state *istate)
if (buf[i] == '\0') { if (buf[i] == '\0') {
int pos, len; int pos, len;
nr_vfs_rows++;
len = buf + i - entry; len = buf + i - entry;
/* look for a directory wild card (ie "dir1/") */ /* look for a directory wild card (ie "dir1/") */
if (buf[i - 1] == '/') { if (buf[i - 1] == '/') {
nr_vfs_dirs++;
if (ignore_case) if (ignore_case)
adjust_dirname_case(istate, entry); adjust_dirname_case(istate, entry);
pos = index_name_pos(istate, entry, len); pos = index_name_pos(istate, entry, len);
if (pos < 0) { if (pos < 0) {
pos = -pos - 1; pos = -pos - 1;
while (pos < istate->cache_nr && !fspathncmp(istate->cache[pos]->name, entry, len)) { while (pos < istate->cache_nr && !fspathncmp(istate->cache[pos]->name, entry, len)) {
if (istate->cache[pos]->ce_flags & CE_SKIP_WORKTREE)
nr_bulk_skip++;
istate->cache[pos]->ce_flags &= ~CE_SKIP_WORKTREE; istate->cache[pos]->ce_flags &= ~CE_SKIP_WORKTREE;
pos++; pos++;
} }
@ -288,18 +298,41 @@ void apply_virtualfilesystem(struct index_state *istate)
} else { } else {
if (ignore_case) { if (ignore_case) {
struct cache_entry *ce = index_file_exists(istate, entry, len, ignore_case); struct cache_entry *ce = index_file_exists(istate, entry, len, ignore_case);
if (ce) if (ce) {
if (ce->ce_flags & CE_SKIP_WORKTREE)
nr_explicit_skip++;
ce->ce_flags &= ~CE_SKIP_WORKTREE; ce->ce_flags &= ~CE_SKIP_WORKTREE;
}
else {
nr_unknown++;
}
} else { } else {
int pos = index_name_pos(istate, entry, len); int pos = index_name_pos(istate, entry, len);
if (pos >= 0) if (pos >= 0) {
if (istate->cache[pos]->ce_flags & CE_SKIP_WORKTREE)
nr_explicit_skip++;
istate->cache[pos]->ce_flags &= ~CE_SKIP_WORKTREE; istate->cache[pos]->ce_flags &= ~CE_SKIP_WORKTREE;
}
else {
nr_unknown++;
}
} }
} }
entry += len + 1; entry += len + 1;
} }
} }
if (nr_vfs_rows > 0) {
trace2_data_intmax("vfs", the_repository, "apply/tracked", nr_bulk_skip + nr_explicit_skip);
trace2_data_intmax("vfs", the_repository, "apply/vfs_rows", nr_vfs_rows);
trace2_data_intmax("vfs", the_repository, "apply/vfs_dirs", nr_vfs_dirs);
trace2_data_intmax("vfs", the_repository, "apply/nr_unknown", nr_unknown);
trace2_data_intmax("vfs", the_repository, "apply/nr_bulk_skip", nr_bulk_skip);
trace2_data_intmax("vfs", the_repository, "apply/nr_explicit_skip", nr_explicit_skip);
}
} }
/* /*