Skip to content

Commit

Permalink
Provide some default values for the ThinLTO Cache pruning
Browse files Browse the repository at this point in the history
This control how the cache is pruned. The cache still has to
be explicitely enabled/disabled by providing a path.

From: Mehdi Amini <[email protected]>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268393 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
joker-eph committed May 3, 2016
1 parent d80450e commit f4c5ea4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions include/llvm-c/lto.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ extern lto_bool_t thinlto_codegen_set_pic_model(thinlto_code_gen_t cg,

/**
* Sets the path to a directory to use as a cache storage for incremental build.
* Setting this activates caching.
*
* \since LTO_API_VERSION=18
*/
Expand All @@ -667,7 +668,7 @@ extern void thinlto_codegen_set_cache_dir(thinlto_code_gen_t cg,

/**
* Sets the cache pruning interval (in seconds). A negative value disable the
* pruning (default).
* pruning. An unspecified default value will be applied.
*
* \since LTO_API_VERSION=18
*/
Expand All @@ -678,7 +679,8 @@ extern void thinlto_codegen_set_cache_pruning_interval(thinlto_code_gen_t cg,
* Sets the maximum cache size that can be persistent across build, 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 space. A value over 100 will be reduced to 100.
* available space. A value over 100 will be reduced to 100. An unspecified
* default value will be applied.
*
* The formula looks like:
* AvailableSpace = FreeSpace + ExistingCacheSize
Expand All @@ -690,7 +692,8 @@ extern void thinlto_codegen_set_final_cache_size_relative_to_available_space(
thinlto_code_gen_t cg, unsigned percentage);

/**
* Sets the expiration (in seconds) for an entry in the cache.
* Sets the expiration (in seconds) for an entry in the cache. An unspecified
* default value will be applied.
*
* \since LTO_API_VERSION=18
*/
Expand Down
8 changes: 4 additions & 4 deletions include/llvm/LTO/ThinLTOCodeGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ class ThinLTOCodeGenerator {
*/

struct CachingOptions {
std::string Path;
int PruningInterval = -1; // seconds, -1 to disable pruning
unsigned int Expiration = 0; // seconds.
unsigned MaxPercentageOfAvailableSpace = 0; // percentage.
std::string Path; // Path to the cache, empty to disable.
int PruningInterval = 1200; // seconds, -1 to disable pruning.
unsigned int Expiration = 7 * 24 * 3600; // seconds (1w default).
unsigned MaxPercentageOfAvailableSpace = 75; // percentage.
};

/// Provide a path to a directory where to store the cached files for
Expand Down

0 comments on commit f4c5ea4

Please sign in to comment.