LLVM 20.0.0git
Public Attributes | List of all members
llvm::CachePruningPolicy Struct Reference

Policy for the pruneCache() function. More...

#include "llvm/Support/CachePruning.h"

Public Attributes

std::optional< std::chrono::seconds > Interval = std::chrono::seconds(1200)
 The pruning interval.
 
std::chrono::seconds Expiration = std::chrono::hours(7 * 24)
 The expiration for a file.
 
unsigned MaxSizePercentageOfAvailableSpace = 75
 The maximum size for the cache directory, in terms of percentage of the available space on the disk.
 
uint64_t MaxSizeBytes = 0
 The maximum size for the cache directory in bytes.
 
uint64_t MaxSizeFiles = 1000000
 The maximum number of files in the cache directory.
 

Detailed Description

Policy for the pruneCache() function.

A default constructed CachePruningPolicy provides a reasonable default policy.

Definition at line 28 of file CachePruning.h.

Member Data Documentation

◆ Expiration

std::chrono::seconds llvm::CachePruningPolicy::Expiration = std::chrono::hours(7 * 24)

The expiration for a file.

When a file hasn't been accessed for Expiration seconds, it is removed from the cache. A value of 0 disables the expiration-based pruning.

Definition at line 38 of file CachePruning.h.

Referenced by llvm::parseCachePruningPolicy(), llvm::pruneCache(), and llvm::ThinLTOCodeGenerator::setCacheEntryExpiration().

◆ Interval

std::optional<std::chrono::seconds> llvm::CachePruningPolicy::Interval = std::chrono::seconds(1200)

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 occur. A value of std::nullopt disables pruning.

Definition at line 33 of file CachePruning.h.

Referenced by llvm::parseCachePruningPolicy(), llvm::pruneCache(), and llvm::ThinLTOCodeGenerator::setCachePruningInterval().

◆ MaxSizeBytes

uint64_t llvm::CachePruningPolicy::MaxSizeBytes = 0

The maximum size for the cache directory in bytes.

A value over the amount of available space on the disk will be reduced to the amount of available space. A value of 0 disables the absolute size-based pruning.

Definition at line 50 of file CachePruning.h.

Referenced by llvm::parseCachePruningPolicy(), llvm::pruneCache(), and llvm::ThinLTOCodeGenerator::setCacheMaxSizeBytes().

◆ MaxSizeFiles

uint64_t llvm::CachePruningPolicy::MaxSizeFiles = 1000000

The maximum number of files in the cache directory.

A value of 0 disables the number of files based pruning.

This defaults to 1000000 because with that many files there are diminishing returns on the effectiveness of the cache. Some systems have a limit on total number of files, and some also limit the number of files per directory, such as Linux ext4, with the default setting (block size is 4096 and large_dir disabled), there is a per-directory entry limit of 508*510*floor(4096/(40+8))~=20M for average filename length of 40.

Definition at line 61 of file CachePruning.h.

Referenced by llvm::parseCachePruningPolicy(), llvm::pruneCache(), and llvm::ThinLTOCodeGenerator::setCacheMaxSizeFiles().

◆ MaxSizePercentageOfAvailableSpace

unsigned llvm::CachePruningPolicy::MaxSizePercentageOfAvailableSpace = 75

The maximum size for the cache directory, in terms of percentage of the available space on 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 disables the percentage size-based pruning.

Definition at line 45 of file CachePruning.h.

Referenced by llvm::parseCachePruningPolicy(), llvm::pruneCache(), and llvm::ThinLTOCodeGenerator::setMaxCacheSizeRelativeToAvailableSpace().


The documentation for this struct was generated from the following file: