================
@@ -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;
----------------
Bigcheese wrote:

Looking at the existing VFSs there appears to be a reasonable subset that 
currently are thread safe for stat/open/etc., but some definitely aren't. I 
think it's fine to make this one thread safe and document that it is if the 
underlying FS is.

I think they can also all be relaxed memory order, you have to have some other 
synchronization before collecting the numbers at the end anyway.

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