]> git.ipfire.org Git - thirdparty/ccache.git/commit
Improve handling of profiling options
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 30 Apr 2020 06:29:31 +0000 (08:29 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Fri, 1 May 2020 12:45:02 +0000 (14:45 +0200)
commitd0eb89deee7e50553b85f77723107eacfacacdff
tree5bdda10e9ef32c5e5514eefd9504b6fc64c5931b
parentde98c44ea1987939f1f2516a5fd402a442012632
Improve handling of profiling options

Handling of -fprofile-{generate,use}[=path] was implemented in PR #2
(2011). ccache has since then gained support for Clang, which is not
GCC-compatible for -fprofile-{generate,use}[=path]. Furthermore, GCC 9
changed the semantics of -fprofile-{generate,use}=path, making it
incompatible with ccache’s original implementation.

One crucial problem with the implementation is that there is no error
handling when the expected profiling data file cannot be found. This
means that there will be false positives cache hits for Clang and GCC
9+.

Fix this by:

* Checking for different profiling data file locations to handle
  different compilers and versions.
* Bailing out if no profiling data file can be found.

Also:

* Implemented support for Clang’s -fprofile-instr-{generate,use}[=path]
  options.
* Implemented support for -fauto-profile[=path].
* Removed the conversion of absolute path to the profile directory.
  91a2954e says that the directory is rewritten to increase the hit
  rate, but I don’t understand how that could be the case.
* Added tests for the profiling options. Exception:
  -fauto-profile[=path], since that would require running the perf tool.

Fixes #582.

(cherry picked from commit c9fdcef576dd13a2ea2355bcd866b5c561cb1562)
src/ArgsInfo.hpp
src/ccache.cpp
test/run
test/suites/profiling.bash [new file with mode: 0644]
test/suites/profiling_clang.bash [new file with mode: 0644]
test/suites/profiling_gcc.bash [new file with mode: 0644]
unittest/test_argument_processing.cpp