summaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CachePruning.cpp
AgeCommit message (Collapse)Author
2023-11-03[Support] Use StringRef::starts_with/ends_with instead of ↵Simon Pilgrim
startswith/endswith. NFC. startswith/endswith wrap starts_with/ends_with and will eventually go away (to more closely match string_view)
2022-11-14[ThinLTO] a ThinLTO warning is added if cache_size_bytes or cache_size_files ↵Ying Yi
is too small for the current link job. The warning recommends the user to consider adjusting --thinlto-cache-policy. A specific case for ThinLTO cache pruning is that the current build is huge, and the cache wasn't big enough to hold the intermediate object files of that build. So in doing that build, a file would be cached, and later in that same build it would be evicted. This was significantly decreasing the effectiveness of the cache. By giving this warning, the user could identify the required cache size/files and improve ThinLTO link speed. Differential Revision: https://reviews.llvm.org/D135590
2021-01-19[ThinLTO] Also prune Thin-* files from the ThinLTO cacheHans Wennborg
Such files (Thin-%%%%%%.tmp.o) are supposed to be deleted immediately after they're used (either by renaming or deletion). However, we've seen instances on Windows where this doesn't happen, probably due to the filesystem being flaky. This is effectively a resource leak which has prevented us from using the ThinLTO cache on Windows. Since those temporary files are in the thinlto cache directory which we prune periodically anyway, allowing them to be pruned too seems like a tidy way to solve the problem. Differential revision: https://reviews.llvm.org/D94962
2020-05-08CachePruning.h - reduce StringRef.h to Optional.h include. NFCSimon Pilgrim
We only need to include Optional.h, forward declare StringRef and move the StringRef.h include down to CachePruning.cpp.
2019-08-05Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song
F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
2019-04-21[CachePruning] Simplify comparatorFangrui Song
llvm-svn: 358843
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-08-22[Support][CachePruning] prune least recently accessed files firstBob Haarman
Summary: Before this change, pruning order was based on size. This changes it to be based on time of last use instead, preferring to keep recently used files and prune older ones. Reviewers: pcc, rnk, espindola Reviewed By: rnk Subscribers: emaste, arichardson, hiraditya, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D51062 llvm-svn: 340374
2018-05-14Rename DEBUG macro to LLVM_DEBUG.Nicola Zaghen
The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM - Manual change to APInt - Manually chage DOCS as regex doesn't match it. In the transition period the DEBUG() macro is still present and aliased to the LLVM_DEBUG() one. Differential Revision: https://reviews.llvm.org/D43624 llvm-svn: 332240
2017-12-22[ThinLTO][CachePruning] explicitly disable pruningBen Dunbobbin
In https://reviews.llvm.org/rL321077 and https://reviews.llvm.org/D41231 I fixed a regression in the c-api which prevented the pruning from being *effectively* disabled. However this approach, helpfully recommended by @labath, is cleaner. It is also nice to remove the weasel words about effectively disabling from the api comments. Differential Revision: https://reviews.llvm.org/D41497 llvm-svn: 321376
2017-12-19[Support][CachePruning] Disable cache pruning regression fixBen Dunbobbin
borked by: rL284966 (see: https://reviews.llvm.org/D25730). Previously, Interval was unsigned (see: CachePruning.h), replacing the type with std::chrono::seconds (which is signed) causes a regression in behaviour because the c-api intends negative values to translate to large positive intervals to *effectively* disable the pruning (see comments on: setCachePruningInterval()). Differential Revision: https://reviews.llvm.org/D41231 llvm-svn: 321077
2017-11-22CachePruning: Allow limiting the number of files in the cache directory.Peter Collingbourne
The default limit is 1000000 but it can be configured with a cache policy. The motivation is that some filesystems (notably ext4) have a limit on the number of files that can be contained in a directory (separate from the inode limit). Differential Revision: https://reviews.llvm.org/D40327 llvm-svn: 318857
2017-11-17[Support][CachePruning] Fix regression in pruning intervalBen Dunbobbin
Fixed broken comparison. borked by: rL284966 (see: https://reviews.llvm.org/D25730). Differential Revision: https://reviews.llvm.org/D40119 This is a second attempt to commit this. The first attempt broke lld and gold tests that had been written against the incorrect behaivour. llvm-svn: 318524
2017-11-16Revert "[Support][CachePruning] Fix regression in pruning interval"Rafael Espindola
This reverts commit r318397. It broke tools/gold/X86/cache.ll. llvm-svn: 318419
2017-11-16[Support][CachePruning] Fix regression in pruning intervalBen Dunbobbin
Fixed broken comparison. borked by: rL284966 (see: https://reviews.llvm.org/D25730). Differential Revision: https://reviews.llvm.org/D40119 llvm-svn: 318397
2017-10-10Support: Have directory_iterator::status() return ↵Peter Collingbourne
FindFirstFileEx/FindNextFile results on Windows. This allows clients to avoid an unnecessary fs::status() call on each directory entry. Because the information returned by FindFirstFileEx is a subset of the information returned by a regular status() call, I needed to extract a base class from file_status that contains only that information. On my machine, this reduces the time required to enumerate a ThinLTO cache directory containing 520k files from almost 4 minutes to less than 2 seconds. Differential Revision: https://reviews.llvm.org/D38716 llvm-svn: 315378
2017-06-23Fix a misleading indentation warning.Peter Collingbourne
llvm-svn: 306130
2017-06-23Make the size specification for cache_size_bytes case insensitive.Peter Collingbourne
llvm-svn: 306129
2017-06-23Add a ThinLTO cache policy for controlling the maximum cache size in bytes.Peter Collingbourne
This is useful when an upper limit on the cache size needs to be controlled independently of the amount of the amount of free space. One use case is a machine with a large number of cache directories (e.g. a buildbot slave hosting a large number of independent build jobs). By imposing an upper size limit on each cache directory, users can more easily estimate the server's capacity. Differential Revision: https://reviews.llvm.org/D34547 llvm-svn: 306126
2017-03-20Support, LTO: When pruning a directory, ignore files matching a prefix.Peter Collingbourne
This is a safeguard against data loss if the user specifies a directory that is not a cache directory. Teach the existing cache pruning clients to create files with appropriate names. Differential Revision: https://reviews.llvm.org/D31109 llvm-svn: 298271
2017-03-16Fix pessimising moves.Peter Collingbourne
llvm-svn: 297928
2017-03-16Support: Add a cache pruning policy parser.Peter Collingbourne
The idea is that the policy string fully specifies the policy and is portable between clients. Differential Revision: https://reviews.llvm.org/D31020 llvm-svn: 297927
2017-03-15Support: Simplify the CachePruning API. NFCI.Peter Collingbourne
Change the function that implements the pruning into a free function that takes the policy as a struct argument. Differential Revision: https://reviews.llvm.org/D31009 llvm-svn: 297907
2016-10-24Remove TimeValue usage from llvm/SupportPavel Labath
Summary: This is a follow-up to D25416. It removes all usages of TimeValue from llvm/Support library (except for the actual TimeValue declaration), and replaces them with appropriate usages of std::chrono. To facilitate this, I have added small utility functions for converting time points and durations into appropriate OS-specific types (FILETIME, struct timespec, ...). Reviewers: zturner, mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25730 llvm-svn: 284966
2016-09-14Missing includes.Vassil Vassilev
llvm-svn: 281450
2016-06-27CachePruning: correct comment about file order. NFCPawel Bylica
Summary: Actually the list of cached files is sorted by file size, not by last accessed time. Also remove unused file access time param for a helper function. Reviewers: joker-eph, chandlerc, davide Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21639 llvm-svn: 273852
2016-05-14CachePruning.cpp: Don't use errno.NAKAMURA Takumi
llvm-svn: 269565
2016-04-21CachePruning: early exit if no path suppliedMehdi Amini
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266965
2016-04-18Add debugging to the cache pruningMehdi Amini
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266686
2016-04-18CachePruning: fix typo, we accumulate file size here, not timeMehdi Amini
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266685
2016-04-02Add Cache Pruning supportMehdi Amini
Incremental LTO will usea cache to store object files. This patch handles the pruning part of the cache, exposing a few knobs: - Pruning interval: the implementation keeps a "timestamp" file in the directory and will scan it only after a given interval since the last modification of the timestamp file. This is for performance purpose, we don't want to scan continuously the folder. - Entry expiration: this is the time after which a file that hasn't been used is remove from the cache. - Maximum size: expressed in percentage of the available disk space, it helps to avoid that we blow up the disk space. http://reviews.llvm.org/D18422 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265209