[clang] [llvm] [llvm][support] Implement tracing virtual file system (PR #88326)
Michael Spencer via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 17 15:22:18 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;
----------------
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
More information about the llvm-commits
mailing list