LLVM 20.0.0git
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
llvm::vfs::TracingFileSystem Class Reference

File system that tracks the number of calls to the underlying file system. More...

#include "llvm/Support/VirtualFileSystem.h"

Inheritance diagram for llvm::vfs::TracingFileSystem:
Inheritance graph
[legend]

Public Member Functions

 TracingFileSystem (llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS)
 
ErrorOr< Statusstatus (const Twine &Path) override
 
ErrorOr< std::unique_ptr< File > > openFileForRead (const Twine &Path) override
 
directory_iterator dir_begin (const Twine &Dir, std::error_code &EC) override
 
std::error_code getRealPath (const Twine &Path, SmallVectorImpl< char > &Output) override
 
bool exists (const Twine &Path) override
 
std::error_code isLocal (const Twine &Path, bool &Result) override
 
- Public Member Functions inherited from llvm::RTTIExtends< TracingFileSystem, ProxyFileSystem >
const void * dynamicClassID () const override
 
bool isA () const
 Check whether this instance is a subclass of QueryT.
 
bool isA (const void *const ClassID) const override
 

Public Attributes

std::size_t NumStatusCalls = 0
 
std::size_t NumOpenFileForReadCalls = 0
 
std::size_t NumDirBeginCalls = 0
 
std::size_t NumGetRealPathCalls = 0
 
std::size_t NumExistsCalls = 0
 
std::size_t NumIsLocalCalls = 0
 

Static Public Attributes

static const char ID = 0
 

Protected Member Functions

void printImpl (raw_ostream &OS, PrintType Type, unsigned IndentLevel) const override
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::RTTIExtends< TracingFileSystem, ProxyFileSystem >
static const void * classID ()
 
static bool classof (const T *R)
 

Detailed Description

File system that tracks the number of calls to the underlying file system.

This is particularly useful when wrapped around RealFileSystem to add lightweight tracking of expensive syscalls.

Definition at line 1151 of file VirtualFileSystem.h.

Constructor & Destructor Documentation

◆ TracingFileSystem()

llvm::vfs::TracingFileSystem::TracingFileSystem ( llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem FS)
inline

Definition at line 1163 of file VirtualFileSystem.h.

Member Function Documentation

◆ dir_begin()

directory_iterator llvm::vfs::TracingFileSystem::dir_begin ( const Twine Dir,
std::error_code &  EC 
)
inlineoverride

◆ exists()

bool llvm::vfs::TracingFileSystem::exists ( const Twine Path)
inlineoverride

Definition at line 1187 of file VirtualFileSystem.h.

References llvm::vfs::ProxyFileSystem::exists(), and NumExistsCalls.

◆ getRealPath()

std::error_code llvm::vfs::TracingFileSystem::getRealPath ( const Twine Path,
SmallVectorImpl< char > &  Output 
)
inlineoverride

◆ isLocal()

std::error_code llvm::vfs::TracingFileSystem::isLocal ( const Twine Path,
bool Result 
)
inlineoverride

Definition at line 1192 of file VirtualFileSystem.h.

References llvm::vfs::ProxyFileSystem::isLocal(), and NumIsLocalCalls.

◆ openFileForRead()

ErrorOr< std::unique_ptr< File > > llvm::vfs::TracingFileSystem::openFileForRead ( const Twine Path)
inlineoverride

◆ printImpl()

void TracingFileSystem::printImpl ( raw_ostream OS,
PrintType  Type,
unsigned  IndentLevel 
) const
overrideprotected

◆ status()

ErrorOr< Status > llvm::vfs::TracingFileSystem::status ( const Twine Path)
inlineoverride

Definition at line 1166 of file VirtualFileSystem.h.

References NumStatusCalls, and llvm::vfs::ProxyFileSystem::status().

Member Data Documentation

◆ ID

const char TracingFileSystem::ID = 0
static

Definition at line 1154 of file VirtualFileSystem.h.

◆ NumDirBeginCalls

std::size_t llvm::vfs::TracingFileSystem::NumDirBeginCalls = 0

Definition at line 1158 of file VirtualFileSystem.h.

Referenced by dir_begin(), and printImpl().

◆ NumExistsCalls

std::size_t llvm::vfs::TracingFileSystem::NumExistsCalls = 0

Definition at line 1160 of file VirtualFileSystem.h.

Referenced by exists(), and printImpl().

◆ NumGetRealPathCalls

std::size_t llvm::vfs::TracingFileSystem::NumGetRealPathCalls = 0

Definition at line 1159 of file VirtualFileSystem.h.

Referenced by getRealPath(), and printImpl().

◆ NumIsLocalCalls

std::size_t llvm::vfs::TracingFileSystem::NumIsLocalCalls = 0

Definition at line 1161 of file VirtualFileSystem.h.

Referenced by isLocal(), and printImpl().

◆ NumOpenFileForReadCalls

std::size_t llvm::vfs::TracingFileSystem::NumOpenFileForReadCalls = 0

Definition at line 1157 of file VirtualFileSystem.h.

Referenced by openFileForRead(), and printImpl().

◆ NumStatusCalls

std::size_t llvm::vfs::TracingFileSystem::NumStatusCalls = 0

Definition at line 1156 of file VirtualFileSystem.h.

Referenced by printImpl(), and status().


The documentation for this class was generated from the following files: