| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
As suggested in discussion #1271.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Aligned how cache size is presented (in "ccache --show-stats", "ccache
--show-compression", "ccache --recompress", debug logs, etc.) and
specified (in configuration files, "ccache --max-size" and "ccache
--trim-max-size"). The size units are now formatted according to the
type of size unit prefix used for the max_size/CCACHE_MAXSIZE setting: a
decimal size unit prefix (k/M/G/T with or without B for bytes) in
max_size means using decimal size unit prefix for presented sizes, and
similar for binary size unit prefixes (Ki/Mi/Gi/Ti with or without B for
bytes). If no unit is specified, GiB is assumed, . For example, "ccache -M
10" means 10 GiB.
Also aligned how cache sizes are calculated. Now all sizes are computed
as "apparent size", i.e., rounded up to the disk block size. This means
that the cache size in "--show-stats" and the sizes presented in
"--show-compression" and "--recompress" now match.
|
| |
|
| |
|
| |
|
|
|
|
| |
Closes #1035.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
This makes it possible to check ordinary log messages when debugging
"ccache -c" and similar options.
|
| |
|
| |
|
|
|
|
| |
This avoids extra stats in some scenarios.
|
|
|
|
|
|
|
| |
- For the --recompress case, only reset timestamps if mtime has changed
since local cache LRU cleanup always uses mtime.
- For the --trim-dir/--trim-recompress case, always reset timestamps
since atime may be used for LRU cleanup.
|
|
|
|
|
|
| |
Note: Reading the header to check the current compression level affects
atime, so we need to restore atime even when recompression is not
performed.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Closes #1197.
|
|
|
|
|
|
|
|
|
|
| |
When compiling an assembler file, -MD and -MMD don't produce any
dependency file, so don't expect one.
Also, make sure to fall back to running the real compiler in case an
expected output file is missing instead of exiting with an error.
Fixes #1189.
|
| |
|
|
|
|
|
|
|
| |
I think that this is more in line with what the namespace represents. I
also renamed ShowIncludesParser::tokenize to
MsvcShowIncludesOutput::get_includes since it's not returning generic
tokens but specifically includes files.
|
| |
|
|
|
|
| |
Useful for listing them in the IDE project tree, for IDEs that use
CMake file api (like Qt Creator).
|
|
|
|
| |
If MSVC is executed *without* /showIncludes, and ccache is configured with
depend mode, add /showIncludes and strip the extra output from stdout.
|
|
|
|
|
|
|
|
|
| |
Based on -showIncludes, which prints included files on stdout with a
certain text prefix. Otherwise pretty similar to depend mode handling
for GCC.
This makes MSVC building way faster.
Co-authored-by: Luboš Luňák <l.lunak@centrum.cz>
|
|
|
|
| |
As discussed in #1173.
|
|
|
|
|
|
| |
This reverts commit 8b65880b5ad817156b58c58b5133aafc99b0a264.
See <https://github.com/ccache/ccache/pull/1158#issuecomment-1268748557>.
|
|
|
| |
Co-authored-by: Luboš Luňák <l.lunak@centrum.cz>
|
|
|
|
|
|
| |
I should not be necessary to distinguish between existence and
non-existence of -frandom-seed if random_seed sloppiness is requested,
so don't hash the "-frandom-seed=" part either.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ccache collects statistics about local and remote storage layer get/put
operations and describes them as "local/remote hits/misses" in the
output of "ccache -s". However, since "hits" and "misses" mean "result
hit/miss" in the "cacheable calls" section, it's easy to think that they
measure the same thing.
This commit improves the situation by:
- Adding new "local/remote hits/misses" counters that mean "result
hit/miss". These are shown if remote storage is used (since they
otherwise are redundant and equal to the normal "hits/misses"
counters) or if the -v/--verbose option is given.
- Presenting the previous "local/remote hits/misses" counters as
"local/remote reads". Only shown in verbose mode.
- Adding "local/remote writes" counters. Only shown in verbose mode.
Closes #1016.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is a feature request to be able not to use a local cache at all,
only a network cache. With such a feature, the names "primary storage"
and "secondary storage" make less sense since ccache would be operating
in "secondary only" mode, but then that storage would of course become
the primary (and only).
Let's rename "primary storage" to "local storage" and "secondary
storage" to "remote storage" – operating in "remote only" mode then
makes sense.
One of the original motivations to call networked storage "secondary" is
that the file storage can be used for local file systems as well, making
such storage "not quite remote", but in practice I guess the file
storage backend used primarily for network file systems.
|
| |
|
|
|
|
| |
This improves accuracy in with "file_stat_matches" sloppiness.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With read-only secondary storage, it can happen that primary storage has
a manifest named M with a result entry R1, while secondary storage also
has a manifest M but with result R2. On a compilation that matches R2,
ccache will first succeed to look up M in primary storage, fail to find
R2 and then get M from secondary storage where R2 can be found. Since M
already exists locally, ccache will simply return the cache hit but not
store knowledge of R2 locally. On a rebuild of R2, ccache therefore
needs to fetch from secondary storage again.
The improvement brought by this commit is that ccache now merges the
manifests from primary and secondary storage and stores the merged
version in primary storage. In other words, ccache setups with read-only
secondary storage will be able to accumulate local header file
combinations and seamlessly combine them with changes from secondary
storage.
Closes #1049.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Cache entries are now fully read into memory before (de)compressing,
checksumming and parsing, instead of streaming data like before. While
this increases memory usage when working with large object files, it
also simplifies the code a lot. Another motivation for this change is
that cache entry data is not streamed from secondary storage anyway, and
it makes sense to keep the architecture simple and similar for primary
and secondary storage code paths.
The cache entry format has modified so that the checksum covers the
potentially compressed payload (plus the header), not the uncompressed
payload (plus the header) like before. The checksum is now also stored
in an uncompressed epilogue. Since the cache entry format has been
changed, the input hash has been changed as well.
|