]> git.ipfire.org Git - thirdparty/ccache.git/commit
feat: Improve cache size presentation and specification
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 2 Mar 2023 17:14:49 +0000 (18:14 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 4 Mar 2023 09:10:21 +0000 (10:10 +0100)
commitac98dee75104f31c95ebe57909b43ff88e336c45
tree32183a113a8a24ef3b55bef237eed3073e5af93c
parent32e35fc80784adbbfe6d35c001b1e6c36a599aaa
feat: Improve cache size presentation and specification

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.
12 files changed:
doc/MANUAL.adoc
src/Config.cpp
src/Config.hpp
src/core/FileRecompressor.cpp
src/core/Statistics.cpp
src/core/mainoptions.cpp
src/storage/local/LocalStorage.cpp
src/storage/local/LocalStorage.hpp
src/util/string.cpp
src/util/string.hpp
unittest/test_Config.cpp
unittest/test_util_string.cpp