================
@@ -1125,6 +1125,54 @@ class YAMLVFSWriter {
   void write(llvm::raw_ostream &OS);
 };
 
+/// File system that tracks the number of calls to the underlying file system.
+/// This is particularly useful when wrapped around \c RealFileSystem to add
+/// lightweight tracking of expensive syscalls.
+class TracingFileSystem
+    : public llvm::RTTIExtends<TracingFileSystem, ProxyFileSystem> {
+public:
+  static const char ID;
+
+  std::size_t NumStatusCalls = 0;
----------------
jansvoboda11 wrote:

I'm contemplating whether to make these atomic. The root `FileSystem` class 
inherits from `ThreadSafeRefCountedBase`, suggesting that VFSs may be 
thread-safe.

For example in `clang-scan-deps`, all workers _could_ use single 
`RealFileSystem`. If we wrapped that in a single thread-safe 
`TracingFileSystem`, we'd very easily get the complete VFS stats. The current 
non-thread-safe approach would require having N of these VFS stacks and then 
manually aggregating the individual VFS stats.

Thoughts?

https://github.com/llvm/llvm-project/pull/88326
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to