mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 08:16:05 +00:00

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.
18 lines
558 B
Plaintext
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
|