]> git.ipfire.org Git - thirdparty/ccache.git/commit
Store cache statistics on level 2 and cache bookkeeping still on level 1
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 19 Sep 2020 19:07:22 +0000 (21:07 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 23 Sep 2020 07:41:38 +0000 (09:41 +0200)
commitfb7c03276ebd7201929f392149e974009dc08102
tree87a3e15e5621f3aa0d6c4d783297818f066566cb
parent8e7b122fe20d1d00d524a40e18b9417dab5e2032
Store cache statistics on level 2 and cache bookkeeping still on level 1

In a “mostly cache hits” scenario, many parallel ccache invocations may
want to update statistics at the same time. Spreading out counter
updates over 256 instead of 16 stats files reduces lock contention
significantly.

Keeping cache bookkeeping (i.e. cache size and files counters) on level
1 preserves backward compatibility with the cleanup algorithm in older
ccache versions.

Some counters displayed by “ccache -s” won’t be accurate when an older
ccache version is run on a cache directory that is also used by ccache
4.x, but that shouldn’t be much of a problem in practice. Also, the
cache statistics isn’t backward compatible anyway since new counters may
be introduced and they will be invisible to older versions.

Closes #168 (only statistics are moved to the second level, though).
src/Statistics.cpp
src/ccache.cpp