|
LLVM
4.0.0
|
Handle pruning a directory provided a path and some options to control what to prune. More...
#include <CachePruning.h>
Public Member Functions | |
| CachePruning (StringRef Path) | |
Prepare to prune Path. More... | |
| CachePruning & | setPruningInterval (std::chrono::seconds PruningInterval) |
| Define the pruning interval. More... | |
| CachePruning & | setEntryExpiration (std::chrono::seconds ExpireAfter) |
| Define the expiration for a file. More... | |
| CachePruning & | setMaxSize (unsigned Percentage) |
| Define the maximum size for the cache directory, in terms of percentage of the available space on the the disk. More... | |
| bool | prune () |
| Peform pruning using the supplied options, returns true if pruning occured, i.e. More... | |
Handle pruning a directory provided a path and some options to control what to prune.
Definition at line 25 of file CachePruning.h.
|
inline |
Prepare to prune Path.
Definition at line 28 of file CachePruning.h.
| bool CachePruning::prune | ( | ) |
Peform pruning using the supplied options, returns true if pruning occured, i.e.
Prune the cache of files that haven't been accessed in a long time.
if PruningInterval was expired.
Definition at line 37 of file CachePruning.cpp.
References llvm::sys::path::append(), llvm::count(), llvm::dbgs(), DEBUG, llvm::sys::fs::disk_space(), llvm::ARMBuildAttrs::File, llvm::sys::fs::space_info::free, llvm::sys::fs::is_directory(), llvm::sys::path::native(), llvm::no_such_file_or_directory, now(), llvm::sys::fs::remove(), llvm::report_fatal_error(), llvm::sys::fs::status(), and writeTimestampFile().
Referenced by llvm::ThinLTOCodeGenerator::run().
|
inline |
Define the expiration for a file.
When a file hasn't been accessed for ExpireAfter seconds, it is removed from the cache. A value of 0 disable the expiration-based pruning.
Definition at line 41 of file CachePruning.h.
Referenced by llvm::ThinLTOCodeGenerator::run().
|
inline |
Define the maximum size for the cache directory, in terms of percentage of the available space on the the disk.
Set to 100 to indicate no limit, 50 to indicate that the cache size will not be left over half the available disk space. A value over 100 will be reduced to 100. A value of 0 disable the size-based pruning.
Definition at line 51 of file CachePruning.h.
References fuzzer::min().
Referenced by llvm::ThinLTOCodeGenerator::run().
|
inline |
Define the pruning interval.
This is intended to be used to avoid scanning the directory too often. It does not impact the decision of which file to prune. A value of 0 forces the scan to occurs.
Definition at line 33 of file CachePruning.h.
Referenced by llvm::ThinLTOCodeGenerator::run().
1.8.6