Skip to content

Commit d03100d

Browse files
jeffhostetlerdscho
authored andcommitted
gvfs:trace2:data: add vfs stats
Report virtual filesystem summary data. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent 05bee9e commit d03100d

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

virtualfilesystem.c

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "git-compat-util.h"
44
#include "environment.h"
55
#include "gettext.h"
6+
#include "trace2.h"
67
#include "config.h"
78
#include "dir.h"
89
#include "hashmap.h"
@@ -258,6 +259,11 @@ void apply_virtualfilesystem(struct index_state *istate)
258259
{
259260
char *buf, *entry;
260261
size_t i;
262+
int nr_unknown = 0;
263+
int nr_vfs_dirs = 0;
264+
int nr_vfs_rows = 0;
265+
int nr_bulk_skip = 0;
266+
int nr_explicit_skip = 0;
261267

262268
if (!repo_config_get_virtualfilesystem(istate->repo))
263269
return;
@@ -275,35 +281,63 @@ void apply_virtualfilesystem(struct index_state *istate)
275281
if (buf[i] == '\0') {
276282
ssize_t pos, len;
277283

284+
nr_vfs_rows++;
285+
278286
len = buf + i - entry;
279287

280288
/* look for a directory wild card (ie "dir1/") */
281289
if (buf[i - 1] == '/') {
290+
nr_vfs_dirs++;
282291
if (ignore_case)
283292
adjust_dirname_case(istate, entry);
284293
pos = index_name_pos(istate, entry, len);
285294
if (pos < 0) {
286295
pos = -pos - 1;
287296
while ((size_t)pos < istate->cache_nr && !fspathncmp(istate->cache[pos]->name, entry, len)) {
297+
if (istate->cache[pos]->ce_flags & CE_SKIP_WORKTREE)
298+
nr_bulk_skip++;
288299
istate->cache[pos]->ce_flags &= ~CE_SKIP_WORKTREE;
289300
pos++;
290301
}
291302
}
292303
} else {
293304
if (ignore_case) {
294305
struct cache_entry *ce = index_file_exists(istate, entry, len, ignore_case);
295-
if (ce)
306+
if (ce) {
307+
if (ce->ce_flags & CE_SKIP_WORKTREE)
308+
nr_explicit_skip++;
296309
ce->ce_flags &= ~CE_SKIP_WORKTREE;
310+
}
311+
else {
312+
nr_unknown++;
313+
}
297314
} else {
298315
int pos = index_name_pos(istate, entry, len);
299-
if (pos >= 0)
316+
if (pos >= 0) {
317+
if (istate->cache[pos]->ce_flags & CE_SKIP_WORKTREE)
318+
nr_explicit_skip++;
300319
istate->cache[pos]->ce_flags &= ~CE_SKIP_WORKTREE;
320+
}
321+
else {
322+
nr_unknown++;
323+
}
301324
}
302325
}
303326

304327
entry += len + 1;
305328
}
306329
}
330+
331+
if (nr_vfs_rows > 0) {
332+
trace2_data_intmax("vfs", the_repository, "apply/tracked", nr_bulk_skip + nr_explicit_skip);
333+
334+
trace2_data_intmax("vfs", the_repository, "apply/vfs_rows", nr_vfs_rows);
335+
trace2_data_intmax("vfs", the_repository, "apply/vfs_dirs", nr_vfs_dirs);
336+
337+
trace2_data_intmax("vfs", the_repository, "apply/nr_unknown", nr_unknown);
338+
trace2_data_intmax("vfs", the_repository, "apply/nr_bulk_skip", nr_bulk_skip);
339+
trace2_data_intmax("vfs", the_repository, "apply/nr_explicit_skip", nr_explicit_skip);
340+
}
307341
}
308342

309343
/*

0 commit comments

Comments
 (0)