FastNetMon

Thursday 22 April 2010

Использование ccache для ускорения компиляции на CentOS 5.4

Подключаем Epel:
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm


Ставим:
yum install -y ccache


Теперь перед компиляций какого-либо ПО требуется сделать подмену PATH, чтобы вызывался не реальный gcc, а его враппер, заставляющий его использовать ccache (мой пример для 64 битной платформы):
export PATH=/usr/lib64/ccache:$PATH


После этого пробуем собрать что-либо большое :)

Потом смотрим статистику:
/usr/bin/ccache -s


Немного тестов

После первой сборки ядра 2.6.33.2 на Core i7 у меня получились примерно такие циферки:
ccache -s
cache directory /var/cache/ccache
cache hit 0
cache miss 4751
called for link 26
not a C/C++ file 53
no input file 415
files in cache 9502
cache size 762.2 Mbytes
max cache size 976.6 Mbytes


И время компиляции:
real 13m9.645s
user 33m20.539s
sys 2m59.188s


А при повторной компиляции с make clean:

ccache -s
cache directory /var/cache/ccache
cache hit 4743
cache miss 4759
called for link 51
not a C/C++ file 106
no input file 764
files in cache 9518
cache size 763.6 Mbytes
max cache size 976.6 Mbytes



real 8m46.094s
user 11m29.093s
sys 1m35.004s



http://www.debian-administration.org/article/Speeding_up_recompilation_with_ccache

No comments :

Post a Comment

Note: only a member of this blog may post a comment.