As part of my build process, I'd like to get statistics on the build time and whether ccache found the item in the cache. I know about ccache -s
where I can compare the previous and current cache hit counts.
However, if I have hundreds of compilation threads running in parallel, the statistics don't tell me which file caused the hit.
The return code of ccache
is that of the compiler. Is there any way I can get ccache to tell me if it was successful?
There are two options:
log_file
in the configuration (or the environment variable CCACHE_LOGFILE
) to a file path. Then you can figure out the result of each compilation from the log data. It can be a bit tedious if there are many parallel ccache invocations (the log file is shared between all of them, so log records from the different processes will be interleaved) but possible by taking the PID part of each log line into account.debug = true
in the configuration (or the environment variable CCACHE_DEBUG=1
). ccache will then store the log for each produced object file in <objectfile>.ccache-log
. Read more in Cache debugging in the ccache manual.