white wooden house during daytime

ccache on kernels

As I am building debian packages of recent kernels, I have to build the same thing over and over again – pretty much three times to be exact. Once for ‘vanilla’, second time for virtual machines and third time for gameservers using the gentoo patchset.

If you check back on my post about ccache on gentoo you might remember that a cache is only good for if you build the same thing over and over again as we do in this case compared to a regular gentoo system. Implementation itself was pretty cheap as I just had to add CC=”ccache gcc” to my make command. To give you some numbers on how this works, here are the stats with a cold cache after a build time of about an hour:

cache hit (direct)                     0
cache hit (preprocessed)               0
cache miss                         15556
cache hit rate                      0.00 %
called for link                       29
called for preprocessing            2857
unsupported code directive             4
no input file                        682
cleanups performed                     0
files in cache                     46654
cache size                           7.2 GB
max cache size                      10.0 GB

As you see – no cache hits. After building a second kernel, you can see ccache shaving off some compile time:

cache hit (direct)                    34
cache hit (preprocessed)             774
cache miss                          7318
cache hit rate                      9.94 %
called for link                       28
called for preprocessing            1964
unsupported code directive             4
no input file                        682
cleanups performed                    17
files in cache                     53763
cache size                           8.8 GB
max cache size                      10.0 GB

The next big thing to get things going faster would be using distcc by extending our CC variable to CC=’ccache distcc gcc’ although I would consider this unpractical due to the toolchain having to be the exact same version on the machines involved plus some advanced networking which goes beyond of what I have at my disposal.

Author:

Leave a Reply

Your email address will not be published. Required fields are marked *