llvm-project/clang/test/Misc/print-stats-vfs.test
Jan Svoboda 6e4dcbb21d
[clang][deps] Print tracing VFS data (#108056)
Clang's `-cc1 -print-stats` shows lots of useful internal data including
basic `FileManager` stats. Since this layer caches some results, it is
unclear how that information translates to actual filesystem accesses.
This PR uses `llvm::vfs::TracingFileSystem` to provide that missing
information.

Similar mechanism is implemented for `clang-scan-deps`'s verbose mode
(`-v`). IO contention proved to be a real bottleneck a couple of times
already and this new feature should make those easier to detect in the
future. The tracing VFS is inserted below the caching FS and above the
real FS.
2024-09-11 16:04:56 -07:00

18 lines
558 B
Plaintext

// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: %clang_cc1 -fsyntax-only %t/tu.c -I %t/dir1 -I %t/dir2 -print-stats 2>&1 | FileCheck %s
//--- tu.c
#include "header.h"
//--- dir1/other.h
//--- dir2/header.h
// CHECK: *** Virtual File System Stats:
// CHECK-NEXT: {{[[:digit:]]+}} status() calls
// CHECK-NEXT: {{[[:digit:]]+}} openFileForRead() calls
// CHECK-NEXT: {{[[:digit:]]+}} dir_begin() calls
// CHECK-NEXT: {{[[:digit:]]+}} getRealPath() calls
// CHECK-NEXT: {{[[:digit:]]+}} exists() calls
// CHECK-NEXT: {{[[:digit:]]+}} isLocal() calls