Skip to content

AnDevi/example_project_with_ccache_hitting_problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Problem with ccache hits after changing headers file's timestamps.

This is minimalistic project showing problem I found out.

Logs

In paths below there are logs presenting my problem, generated before and after changing timestamp of header included in pch file:

How to reproduce this issue by yourself:

Ccache settings:

run_second_cpp=true
depend_mode=true
direct_mode=true
file_clone=true
inode_cache=true
sloppiness=ivfsoverlay,modules,include_file_mtime,include_file_ctime,time_macros,pch_defines,clang_index_store,system_headers,locale

Optional environment to build and reproduce this issue:

I prepared Dockerfile with clang and qbs to reproduce it.

To build docker use script (may take a while):

./docker_build.sh

To run docker's container with prepared image use:

./docker_run.sh

Build and reproduce this issue:

To build go to dir project:

  1. Run script:
./qbs_install.sh

First build so obviously we cache no hits, ccache -s output:

Summary:
  Hits:               0 /     2 (0.00 %)
    Direct:           0 /     2 (0.00 %)
    Preprocessed:     0 /     2 (0.00 %)
  Misses:             2
    Direct:           2
    Preprocessed:     2
Primary storage:
  Hits:               0 /     3 (0.00 %)
  Misses:             3
  Cache size (GB): 0.01 / 20.00 (0.04 %)
  1. Delete previous build and build it again:
./qbs_install.sh

Now we have hits, ccache -s output:

Summary:
  Hits:               2 /     4 (50.00 %)
    Direct:           2 /     4 (50.00 %)
    Preprocessed:     0 /     2 (0.00 %)
  Misses:             2
    Direct:           2
    Preprocessed:     2
Primary storage:
  Hits:               4 /     7 (57.14 %)
  Misses:             3
  Cache size (GB): 0.01 / 20.00 (0.04 %)
  1. Here is where the problems begin, before next build change timestamp of headerfile and then build again:
touch common/common.hpp
./qbs_install.sh

Now again we have no hits, ccache -s output:

Summary:
  Hits:               2 /     6 (33.33 %)
    Direct:           2 /     6 (33.33 %)
    Preprocessed:     0 /     4 (0.00 %)
  Misses:             4
    Direct:           4
    Preprocessed:     4
Primary storage:
  Hits:               6 /    10 (60.00 %)
  Misses:             4
  Cache size (GB): 0.01 / 20.00 (0.04 %)

Above are logs from that scenario which leads to undesirable cache misses.

Workaround solution:

In project.qbs change value useWorkaround to true to use pch files as prefix headers and just include them instead of using them as precompile headers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published