[clang] [llvm] [llvm][support] Implement tracing virtual file system (PR #88326)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 8 14:41:36 PDT 2024


================
@@ -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:

@aganea Any thoughts? I'm asking because of https://github.com/llvm/llvm-project/pull/88427. I that making the counters atomic in this PR is not that problematic, since you can still choose how you use the VFS (i.e. how many per core you share), unlike the originally global counters in `FileManager` in your PR.

https://github.com/llvm/llvm-project/pull/88326


More information about the cfe-commits mailing list