Joel Rosdahl [Tue, 28 Sep 2021 18:36:17 +0000 (20:36 +0200)]
fix: Don’t update manifest on preprocessed hit with disabled direct mode
After c7c0837a23fe9dc79613bf3dd4ddd8d91c58d541, update_manifest_file can
be called erroneously if the direct mode is disabled when there has been
a preprocessed hit.
Fix this by asserting that update_manifest_file is only called when
direct mode is enabled, fixing the call site and adding the test case
that should already have existed.
Joel Rosdahl [Fri, 20 Aug 2021 17:56:17 +0000 (19:56 +0200)]
fix(test): Fix .incbin test with newer binutils
The assembler in binutils 2.37 doesn’t want to include /dev/null with
a .incbin directive:
/tmp/ccbGWiew.s: Assembler messages:
/tmp/ccbGWiew.s:4: Error: unable to include `/dev/null'
incbin.s: Assembler messages:
incbin.s:1: Error: unable to include `/dev/null'
Joel Rosdahl [Thu, 19 Aug 2021 18:34:43 +0000 (20:34 +0200)]
build: Improve detection av Ccache version from source repo
When running CMake outside the source repository a plain git command
naturally won’t find the repository. Fix this by pointing git towards
the repository.
Joel Rosdahl [Mon, 16 Aug 2021 06:10:21 +0000 (08:10 +0200)]
feat: Improve statistics summary
The number of statistics counters has become very large, making the
output “ccache -s” hard to overview.
Improvements:
- The -s/--show-stats option now prints a more condensed overview where
the counters representing “uncacheable calls” are summed as
“uncacheable” and “errors” counters. Note: Scripts should use
--print-stats instead of trying to parse the output of --show-stats.
- Added hit rate for direct/preprocessed hits/misses as well.
- Added a new -v/--verbose option, which makes --show-stats and
--show-log-stats show more details.
Joel Rosdahl [Tue, 10 Aug 2021 13:32:07 +0000 (15:32 +0200)]
feat: Make --config-path and --directory affect whole command line
Command line options are processed strictly in order, which means that
ccache -d dir -s
is not the same as
ccache -s -d dir
which is not very intuitive. There are also planned features where is
doesn’t make sense to have to put “non-command options” before the
“command options”.
Improve this by processing command line options in two passes: first
non-command options and then command options (still in order).
Joel Rosdahl [Sun, 8 Aug 2021 08:40:58 +0000 (10:40 +0200)]
refactor: Improve handling of statistics updates and expected events
Ccache uses exceptions for both truly exceptional events (such as I/O
error) and non-exceptional events (such as unsupported compiler
arguments). Regardless of the nature of the event, at most one
statistics counter can be incremented.
Improve this by:
- Using nonstd::expected instead of exceptions internally in the main
code flow. This makes the code easier to reason about.
- Adding support for communicating several statistics counter updates
both for success and failure code paths. This is in preparation for
future improvements of statistics related to secondary storage.
Joel Rosdahl [Sat, 7 Aug 2021 11:12:56 +0000 (13:12 +0200)]
fix: Don’t read let Context read user configuration in unit tests
accd21e4 inadvertently made unit tests populate Context::config from the
environment and the user configuration. Fix this by moving code for
reading config, setting of logging, etc. into a separate method only to
be called by non-test code.
Joel Rosdahl [Sat, 7 Aug 2021 07:00:17 +0000 (09:00 +0200)]
feat(storage): Add support for cache sharding on secondary storage (#912)
This adds support for a shards attribute with a comma-separated list of
names for sharding (partitioning) the cache entries using Rendezvous
hashing, typically to spread the cache over a server cluster. When set,
the storage URL must contain an asterisk (*), which will be replaced by
one of the shard names to form a real URL. A shard name can optionally
have an appended weight within parentheses to indicate how much of the
key space should be associated with that shard. A shard with weight w
will contain w/S of the cache, where S is the sum of all shard weights.
A weight could for instance be set to represent the available memory for
a memory cache on a specific server. The default weight is 1.
will put 55% (3/5.5) of the cache on redis://cache-a.example.com, 18%
(1/5.5) on redis://cache-b.example.com and 27% (1.5/5.5) on
redis://cache-c.example.com.
Joel Rosdahl [Fri, 30 Jul 2021 18:10:50 +0000 (20:10 +0200)]
build: Only probe for faster linker in dev build mode and on x86_64
Using Gold or LLD on less common platforms such as MIPS may not be a
good idea (see e.g.
<https://www.sourceware.org/bugzilla/show_bug.cgi?id=22838>), so be
conservative and only probe for a faster linker on platforms that likely
don’t have toolchain bugs. Also, using a faster linker is in practice
only relevant for dev builds.