<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/ccache.git/src/core/Statistics.cpp, branch master</title>
<subtitle>github.com: ccache/ccache
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/'/>
<entry>
<title>chore: Add comments for all statistics counters</title>
<updated>2023-04-19T16:41:52+00:00</updated>
<author>
<name>Joel Rosdahl</name>
<email>joel@rosdahl.net</email>
</author>
<published>2023-04-19T15:08:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/commit/?id=e08efb42c194c3234a268b2f0a3b715de8b4914a'/>
<id>e08efb42c194c3234a268b2f0a3b715de8b4914a</id>
<content type='text'>
As suggested in discussion #1271.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As suggested in discussion #1271.
</pre>
</div>
</content>
</entry>
<entry>
<title>feat: Make it possible to disable ccache for a certain source code file</title>
<updated>2023-03-07T19:17:35+00:00</updated>
<author>
<name>Joel Rosdahl</name>
<email>joel@rosdahl.net</email>
</author>
<published>2023-03-06T20:22:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/commit/?id=b3c3e7998c6497f8d354da77c7ed6184381c6247'/>
<id>b3c3e7998c6497f8d354da77c7ed6184381c6247</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>feat: Improve cache size presentation and specification</title>
<updated>2023-03-04T09:10:21+00:00</updated>
<author>
<name>Joel Rosdahl</name>
<email>joel@rosdahl.net</email>
</author>
<published>2023-03-02T17:14:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/commit/?id=ac98dee75104f31c95ebe57909b43ff88e336c45'/>
<id>ac98dee75104f31c95ebe57909b43ff88e336c45</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>feat: Improve automatic cache cleanup mechanism</title>
<updated>2023-01-17T19:25:06+00:00</updated>
<author>
<name>Joel Rosdahl</name>
<email>joel@rosdahl.net</email>
</author>
<published>2023-01-05T18:14:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/commit/?id=defb83cc6641b7356c1426c0ba782ac735748917'/>
<id>defb83cc6641b7356c1426c0ba782ac735748917</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>feat: Consistently show cache size and max size with one decimal</title>
<updated>2023-01-11T18:42:32+00:00</updated>
<author>
<name>Joel Rosdahl</name>
<email>joel@rosdahl.net</email>
</author>
<published>2023-01-02T19:46:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/commit/?id=26f8e94b86df915a33152f35697b5446442efb1b'/>
<id>26f8e94b86df915a33152f35697b5446442efb1b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix: Avoid sometimes too wide percent figure in --show-stats</title>
<updated>2023-01-11T18:42:31+00:00</updated>
<author>
<name>Joel Rosdahl</name>
<email>joel@rosdahl.net</email>
</author>
<published>2022-12-30T20:49:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/commit/?id=dfb749a6c871babefff358c3b1a460a33dea67a0'/>
<id>dfb749a6c871babefff358c3b1a460a33dea67a0</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix: Fix conditions for --show-stats</title>
<updated>2022-12-13T19:38:38+00:00</updated>
<author>
<name>Joel Rosdahl</name>
<email>joel@rosdahl.net</email>
</author>
<published>2022-12-12T13:33:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/commit/?id=5d00143e447a50ef9f4709e685c9f0776431c00b'/>
<id>5d00143e447a50ef9f4709e685c9f0776431c00b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix: Handle -MD/-MMD when compiling assembler file</title>
<updated>2022-10-19T20:27:34+00:00</updated>
<author>
<name>Joel Rosdahl</name>
<email>joel@rosdahl.net</email>
</author>
<published>2022-10-19T20:13:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/commit/?id=b53afeb556d55576ed3683fef6566361464393d5'/>
<id>b53afeb556d55576ed3683fef6566361464393d5</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>feat: Improve statistics for remote hits/misses</title>
<updated>2022-10-04T14:44:16+00:00</updated>
<author>
<name>Joel Rosdahl</name>
<email>joel@rosdahl.net</email>
</author>
<published>2022-10-03T18:18:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/commit/?id=2ea3416d9b94663fcdab3063565ad7b9d29716c2'/>
<id>2ea3416d9b94663fcdab3063565ad7b9d29716c2</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>refactor: Sort k_statistics_fields</title>
<updated>2022-10-02T11:26:22+00:00</updated>
<author>
<name>Joel Rosdahl</name>
<email>joel@rosdahl.net</email>
</author>
<published>2022-10-02T11:26:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/ccache.git/commit/?id=e5d2eb8c7703ade8b6f216dd677d35c7019cc918'/>
<id>e5d2eb8c7703ade8b6f216dd677d35c7019cc918</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
