|
LLVM 23.0.0git
|
Interface for logging low-level on-disk cas operations. More...
#include "llvm/CAS/OnDiskCASLogger.h"
Public Types | |
| using | TrieOffset = int64_t |
An offset into an OnDiskTrieRawHashMap. | |
Static Public Member Functions | |
| static LLVM_ABI Expected< std::unique_ptr< OnDiskCASLogger > > | open (const Twine &Path, bool LogAllocations) |
Create or append to a log file inside the given CAS directory Path. | |
| static LLVM_ABI Expected< std::unique_ptr< OnDiskCASLogger > > | openIfEnabled (const Twine &Path) |
Create or append to a log file inside the given CAS directory Path if logging is enabled by the environment variable LLVM_CAS_LOG. | |
Interface for logging low-level on-disk cas operations.
This log is intended to mirror the low-level details of the CAS in order to aid with debugging corruption or other issues with the on-disk format.
Definition at line 33 of file OnDiskCASLogger.h.
| using llvm::cas::ondisk::OnDiskCASLogger::TrieOffset = int64_t |
An offset into an OnDiskTrieRawHashMap.
Definition at line 52 of file OnDiskCASLogger.h.
| OnDiskCASLogger::~OnDiskCASLogger | ( | ) |
Definition at line 46 of file OnDiskCASLogger.cpp.
| void OnDiskCASLogger::logHashMappedTrieHandleCreateRecord | ( | void * | Region, |
| TrieOffset | TrieOffset, | ||
| ArrayRef< uint8_t > | Hash ) |
Definition at line 165 of file OnDiskCASLogger.cpp.
References llvm::format_bytes(), and formatTrieOffset().
| void OnDiskCASLogger::logMappedFileRegionArenaAllocate | ( | void * | Region, |
| TrieOffset | Off, | ||
| size_t | Size ) |
Definition at line 210 of file OnDiskCASLogger.cpp.
References formatTrieOffset(), and Size.
| void OnDiskCASLogger::logMappedFileRegionArenaClose | ( | StringRef | Path | ) |
Definition at line 206 of file OnDiskCASLogger.cpp.
| void OnDiskCASLogger::logMappedFileRegionArenaCreate | ( | StringRef | Path, |
| int | FD, | ||
| void * | Region, | ||
| size_t | Capacity, | ||
| size_t | Size ) |
Definition at line 181 of file OnDiskCASLogger.cpp.
References llvm::format_hex(), llvm::sys::fs::UniqueID::getDevice(), llvm::sys::fs::UniqueID::getFile(), llvm::sys::fs::file_status::getUniqueID(), and Size.
| void OnDiskCASLogger::logMappedFileRegionArenaOom | ( | StringRef | Path, |
| size_t | Capacity, | ||
| size_t | Size, | ||
| size_t | AllocSize ) |
Definition at line 199 of file OnDiskCASLogger.cpp.
References Size.
| void OnDiskCASLogger::logMappedFileRegionArenaResizeFile | ( | StringRef | Path, |
| size_t | Before, | ||
| size_t | After ) |
Definition at line 173 of file OnDiskCASLogger.cpp.
| void OnDiskCASLogger::logSubtrieHandleCmpXchg | ( | void * | Region, |
| TrieOffset | Trie, | ||
| size_t | SlotI, | ||
| TrieOffset | Expected, | ||
| TrieOffset | New, | ||
| TrieOffset | Previous ) |
Definition at line 141 of file OnDiskCASLogger.cpp.
References formatTrieOffset().
| void OnDiskCASLogger::logSubtrieHandleCreate | ( | void * | Region, |
| TrieOffset | Trie, | ||
| uint32_t | StartBit, | ||
| uint32_t | NumBits ) |
Definition at line 156 of file OnDiskCASLogger.cpp.
References formatTrieOffset().
| void OnDiskCASLogger::logTempFileCreate | ( | StringRef | Name | ) |
Definition at line 245 of file OnDiskCASLogger.cpp.
Definition at line 250 of file OnDiskCASLogger.cpp.
| void OnDiskCASLogger::logTempFileRemove | ( | StringRef | TmpName, |
| std::error_code | EC ) |
Definition at line 258 of file OnDiskCASLogger.cpp.
| void OnDiskCASLogger::logUnifiedOnDiskCacheCollectGarbage | ( | StringRef | Path | ) |
Definition at line 221 of file OnDiskCASLogger.cpp.
| void OnDiskCASLogger::logUnifiedOnDiskCacheValidateIfNeeded | ( | StringRef | Path, |
| uint64_t | BootTime, | ||
| uint64_t | ValidationTime, | ||
| bool | CheckHash, | ||
| bool | AllowRecovery, | ||
| bool | Force, | ||
| std::optional< StringRef > | LLVMCas, | ||
| StringRef | ValidationError, | ||
| bool | Skipped, | ||
| bool | Recovered ) |
Definition at line 226 of file OnDiskCASLogger.cpp.
References llvm::StringRef::empty(), llvm::cas::Recovered, and llvm::cas::Skipped.
|
static |
Create or append to a log file inside the given CAS directory Path.
| Path | The parent directory of the log file. |
| LogAllocations | Whether to log all low-level allocations. This is on the order of twice as expensive to log. |
Definition at line 71 of file OnDiskCASLogger.cpp.
References llvm::sys::path::append(), llvm::sys::fs::CD_OpenAlways, llvm::createFileError(), llvm::sys::fs::FA_Write, Filename, and llvm::sys::fs::OF_Append.
Referenced by openIfEnabled().
|
static |
Create or append to a log file inside the given CAS directory Path if logging is enabled by the environment variable LLVM_CAS_LOG.
If LLVM_CAS_LOG is set >= 2 then also log allocations.
Definition at line 60 of file OnDiskCASLogger.cpp.
References llvm::StringRef::getAsInteger(), isDisabledEnv(), and open().
Referenced by llvm::cas::ondisk::UnifiedOnDiskCache::open(), and llvm::cas::ondisk::UnifiedOnDiskCache::validateIfNeeded().