summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* fix: Don't read first character of empty stringsJoel Rosdahl2023-02-051-2/+2
|
* fix: Handle Unix-style paths as non-options to MSVCJoel Rosdahl2023-02-052-141/+169
| | | | | | | | | | | For MSVC, ccache treats all arguments starting with a slash as an option, which makes it fail to detect the source code file if it's passed as a Unix-style absolute path. Fix this by not treating an argument as an option if it's (a) an unknown option, and (b) the argument exists as a file in the file system. Fixes #1230.
* chore: Fix spelling in commentJoel Rosdahl2023-02-031-1/+1
|
* feat: Log executed command lines on WindowsJoel Rosdahl2023-02-031-1/+3
|
* feat: Add quotes around arguments with space in logged command linesJoel Rosdahl2023-02-031-2/+4
|
* docs: Fix bad reference to "Remote storage backends"Joel Rosdahl2023-02-011-2/+3
|
* fix: Fix rare crash in signal handlerJoel Rosdahl2023-02-013-48/+64
| | | | | | | | | | | | If the process is signaled after SignalHandler::~SignalHandler has run then this assert will trigger: ccache: SignalHandler.cpp:87: static void SignalHandler::on_signal(int): failed assertion: g_the_signal_handler Fix this by deregistering the signal handler function before destructing the SignalHandler object. Fixes #1246.
* bump: Upgrade to cpp-httplib 0.11.4Joel Rosdahl2023-01-312-99/+339
|
* build: Fix Zstd and Hiredis downloads for unstable GitHub archivesJoel Rosdahl2023-01-312-4/+3
| | | | | | | | | | | The content of the Zstd and Hiredis GitHub source achive URLs like <https://github.com/$X/$Y/archive/$tag.tar.gz> apparently change from time to time. Color me surprised. [1] says that this is intentional (although, at the time of writing, reverted temporarily). Let's use another URL for Zstd and not verify the checksum for Hiredis (since there is no release source archive). [1]: https://github.blog/changelog/2023-01-30-git-archive-checksums-may-change/
* ci: Upgrade to Node 16-based actionsJoel Rosdahl2023-01-302-11/+11
| | | | | Reference: <https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/>
* fix: Cache path relativization in preprocessed outputJoel Rosdahl2023-01-292-5/+17
| | | | | | | | | | | | | | After PR #1033 and [1], a stat call is made each time a note about an include file is found in the preprocessed output. Such calls are very performant on Linux (and therefore unnoticed until now), but apparently costly on Windows. Fix this by caching the calculation of relative paths in process_preprocessed_file. [1]: 9a05332915d2808f4713437006b3f7c812d9fd74 Closes #1245.
* fix: Disable inode cache if filesystem risks getting full soonJoel Rosdahl2023-01-292-10/+41
| | | | | | | | | | | | | | | Some filesystems, for instance btrfs with compression enabled, apparently make a posix_fallocate call succeed without actually allocating the requested space for the file. This means that if the file is mapped into memory, like done by the inode cache, the process can crash when accessing the memory if the filesystem is full. This commit implements a workaround: the inode cache is disabled if the filesystem reports that it has less than 100 MiB free space. The free space check is valid for one second before it is done again. This should hopefully make crashes very rare in practice. Closes #1236.
* ci: Build macOS binary in release modeJoel Rosdahl2023-01-291-0/+1
|
* feat: Allow forcing download of zstd and hiredis againJoel Rosdahl2023-01-296-69/+100
| | | | | | | | | | | | | | | | Before it was possible to force downloading of the Zstandard library using "-D ZSTD_FROM_INTERNET=ON" and similar for Hiredis. That ability was lost in 2c742c2c7ca9, so if you for some reason want to not use a locally installed library you're out of luck. Improve this by letting ZSTD_FROM_INTERNET and HIREDIS_FROM_INTERNET be tristate variables: ON: Always download AUTO (default): Download if local installation not found OFF: Never download As mentioned in #1240.
* chore: Improve variable name and commentsJoel Rosdahl2023-01-291-6/+7
|
* doc: Fix spellingJoel Rosdahl2023-01-271-1/+1
|
* ci: Build macOS universal binary (#1240)Raihaan Shouhell2023-01-274-8/+57
|
* feat: Add support for -Wp,-U<macro> in direct modeJoel Rosdahl2023-01-183-3/+17
|
* fix: Don't treat -Wp,-D as interchangeable with -DJoel Rosdahl2023-01-183-5/+24
| | | | Fixes #1238.
* test: Use grep -E/-F instead of obsolescent egrep/fgrepJoel Rosdahl2023-01-176-13/+13
|
* feat: Improve automatic cache cleanup mechanismJoel Rosdahl2023-01-1718-537/+834
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cache cleanup mechanism has worked essentially the same ever since ccache was initially created in 2002: - The total number and size of all files in one of the 16 subdirectories (AKA level 1) are kept in the stats file in said subdirectory. - On a cache miss, the new compilation result file is written (based on the first digits of the hash) to a subdirectory of one of those 16 subdirectories, and the stats file is updated accordingly. - Automatic cleanup is triggered if the size of the level 1 subdirectory becomes larger than max_size / 16. - ccache then lists all files in the subdirectory recursively, stats them to check their size and mtime, sorts the file list on mtime and deletes the 20% oldest files. Some problems with the approach described above: - (A) If several concurrent ccache invocations result in a cache miss and write their results to the same subdirectory then all of them will start cleaning up the same subdirectory simultaneously, doing unnecessary work. - (B) The ccache invocation that resulted in a cache miss will perform cleanup and then exit, which means that an arbitrary ccache process that happens to trigger cleanup will take a long time to finish. - (C) Listing all files in a subdirectory of a large cache can be quite slow. - (D) stat-ing all files in a subdirectory of a large cache can be quite slow. - (E) Deleting many files can be quite slow. - (F) Since a cleanup by default removes 20% of the files in a subdirectory, the actual cache size will (once the cache limit is reached) on average hover around 90% of the configured maximum size, which can be confusing. This commit solves or improves on all of the listed problems: - Before starting automatic cleanup, a global "auto cleanup" lock is acquired (non-blocking) so that at most one process is performing cleanup at a time. This solves the potential "cache cleanup stampede" described in (A). - Automatic cleanup is now performed in just one of the 256 level 2 directories. This means that a single cleanup on average will be 16 times faster than before. This improves on (B), (C), (D) and (E) since the cleanup made by a single compilation will not have to access a large part of the cache. On the other hand, cleanups will be triggered 16 times more often, but the cleanup duty will be more evenly spread out during a build. - The total cache size is calculated and compared with the configured maximum size before starting automatic cleanup. This, in combination with performing cleanup on level 2, means that the actual cache size will stay very close to the maximum size instead of about 90%. This solves (F). The limit_multiple configuration option has been removed since it is no longer used. Closes #417.
* chore: Add unit tests for parsing size with (undocumented) B suffixJoel Rosdahl2023-01-151-1/+4
|
* enhance: Delay LongLivedLockFileManager thread start to first registerJoel Rosdahl2023-01-154-33/+47
|
* fix: Fix logging of inactive lock durationJoel Rosdahl2023-01-151-3/+3
|
* enhance: Make it possible for LockFile::try_acquire to break the lockJoel Rosdahl2023-01-152-39/+14
| | | | | | | | | | | If a long-lived lock is stale and has no alive file, LockFile::try_acquire will never succeed to acquire the lock. Fix this by creating the alive file for all lock types and making LockFile::try_acquire exit when lock activity is seen instead of immediately after failing to acquire the lock. Another advantage is that a stale lock can now always be broken right away if the alive file exists.
* feat: Consistently show cache size and max size with one decimalJoel Rosdahl2023-01-111-3/+3
|
* enhance: Make util::LockFile movableJoel Rosdahl2023-01-112-0/+40
|
* chore: Add missing explicit keywords to some constructorsJoel Rosdahl2023-01-112-2/+2
|
* fix: Avoid sometimes too wide percent figure in --show-statsJoel Rosdahl2023-01-111-3/+6
| | | | | | | If the nominator is 99999 and the denominator is 100000, the percent function in Statistics.cpp would return "(100.00%)" instead of the wanted "(100.0%)". Fix this by using the alternate format string if the result string overflows its target size.
* enhance: Add offsetted get/set/increment methods for StatisticsCountersJoel Rosdahl2023-01-112-7/+33
|
* feat: Activate logging for command mode optionsJoel Rosdahl2023-01-111-0/+2
| | | | | This makes it possible to check ordinary log messages when debugging "ccache -c" and similar options.
* enhance: Make storage::local::StatsFile movableJoel Rosdahl2023-01-111-1/+1
|
* doc: Add note that "stats = false" will disable automatic cleanupJoel Rosdahl2023-01-111-2/+2
|
* feat: Do clean/clear/evict-style operations per level 2 directoryJoel Rosdahl2023-01-116-384/+353
| | | | | | Progress bars will now be smoother since the operations are now divided into 256 instead of 16 "read files + act on files" steps. This is also in preparation for future improvements related to cache cleanup.
* refactor: Merge LocalStorage implemention filesJoel Rosdahl2023-01-117-542/+437
|
* chore: Remove special logic for cleaning up legacy ccache filesJoel Rosdahl2023-01-111-18/+0
|
* refactor: Use std::size to compute array sizeJoel Rosdahl2023-01-111-10/+5
|
* chore: Clean up minor things after 95e6375813f7Joel Rosdahl2023-01-043-35/+10
|
* fix: Use spinlocks for inode cache memory synchronization (#1229)Oleg Sidorkin2023-01-044-37/+67
| | | | | | | | | | | Changed the inode cache implementation to use spinlocks instead of pthread mutexes. This makes the inode cache work on FreeBSD and other systems where the pthread mutexes are destroyed when the last memory mapping containing the mutexes is unmapped. Also added tmpfs, ufs and zfs to the list of supported filesystems on macOS and BSDs. See also ccache discussion #1228.
* ci: Test more compilers (#1234)Raihaan Shouhell2022-12-261-1/+17
|
* fix: Only use original umask when retrieving resultJoel Rosdahl2022-12-232-3/+16
| | | | | | | This fixes a problem where the original umask would be used when storing a remote cache result in the local cache in from_cache. Fixes #1235.
* fix: Fix matching of base directory for MSVCJoel Rosdahl2022-12-235-12/+27
| | | | | | The base directory will now match case-insensitively with absolute paths in preprocessed output, or from /showIncludes in the depend mode case, when compiling with MSVC.
* fix: Don't crash in TextTable for a single heading rowJoel Rosdahl2022-12-232-0/+9
|
* chore: Remove defunct LGTM badgesJoel Rosdahl2022-12-231-2/+0
| | | | lgtm.com has been shut down.
* fix: Do not escape backslashes in MSVC RSP files (#1233)Raihaan Shouhell2022-12-232-4/+12
|
* fix: Improve fix for local/remote cache misses in depend modeJoel Rosdahl2022-12-204-20/+42
|
* fix: Fix reporting of local/remote cache misses in depend modeJoel Rosdahl2022-12-134-0/+70
|
* fix: Fix conditions for --show-statsJoel Rosdahl2022-12-131-2/+4
|
* chore: Bump clang-format version requirement to 11+Joel Rosdahl2022-12-132-9/+10
|
* doc: Fix markupJoel Rosdahl2022-12-131-1/+1
|