'How to use `ccache -s` to show hit rates for different CCACHE_DIR
When I use ccache -s, I get like this.
root@iZwz98um4r4f2aucz24e1yZ:~# ccache -s
cache directory /root/.ccache
primary config /root/.ccache/ccache.conf
secondary config (readonly) /etc/ccache.conf
But when I set different environment CCACHE_DIR for my different C++ projects, how can I get my CCACHE_DIR statistics? Is there parameters can do this?
Solution 1:[1]
The way to do it is to set the CCACHE_DIR (temporarily if you want) when running ccache -s, for instance like this:
CCACHE_DIR=/path/to/the/cache/dir ccache -s
Solution 2:[2]
As per the documentation:
-d, --dir PATH
Let the command line options operate on cache directory PATH instead of the default. For example, to show statistics for a cache directory at /shared/ccache you can run ccache -d /shared/ccache -s. Using this option has the same effect as setting the environment variable CCACHE_DIR temporarily.
Available from Ccache version 4.0 onwards.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Joel Rosdahl |
| Solution 2 | Maarten Bamelis |
