Update : Recorded a short video on it !
1. First we need to install ccache which is already available in Ubuntu repositories
$sudo apt-get install ccache2. Now let us configure our system to use ccache. Edit your ~/.bashrc
$vim ~/.bashrcAnd add the following lines to the end of the file
# ccache export CCACHE_DIR="/home/prashants/.ccache" export CC="ccache gcc" export CXX="ccache g++" export PATH="/usr/lib/ccache:$PATH"Replace the /home/prashant/.ccache folder to your own home folder. It is a empty folder that ccache will use to store the result of the compilation. You can use any other folder name of your choice.
The /usr/lib/ccache folder is automatically created by ccache and it contains symlinks to ccache for gcc/g++ compiler names. By adding it to our PATH environment variable, ccache will be called instead of gcc compiler.
$ls /usr/lib/ccacheNow to apply the changes in the ~/.bashrc file
$source ~/.bashrc3. Next we need to setup the maximum cache size
$ccache -M 2GThis limits the cache size to 2GB. You can change it to something more if you have enough free space.
4. You are done ! Next time you run gcc/g++/make commands it will use ccache. You can monitor the current usage of ccache by executing
$watch -n1 -d ccache -s5. Lets try it out ! Download the latest linux kernel source from http://kernel.org and compile it. Simultaneously keep a terminal open with the above command running and you will see this
Combining ccache along with distributed kernel compilation can give really amazing results ! Read about the distributed kernel compilation in my previous article here.
Wow. That is so elegant and logical and clearly explained. Keep it up! I follow up your blog for future post.
ReplyDeleteRegards,
Linux Online Training | Linux Training in Hyderabad | Linux Online Training in Hyderabad | Linux Online Training in India | Linux Online Training Institutes in Hyderabad | Best Institutes for Linux in Hyderabad | Linux Training Institutes in Hyderabad | Linux Training Institutes in India | Linux Online Training hyderabad | Linux Online Training India | Best Institutes for Linux | Linux Administration Training in Hyderabad | Linux Certification Training | Linux Training in Ameerpet, Hyderabad | Red Hat Linux Training in Hyderabad | Linux Certification Training in Hyderabad | Best Linux online Training Institutes in Hyderabad | Learn Linux | Learn Linux Online
Any danger in doing this on a ramdisk? Or does this get rid of the whole idea?
ReplyDeleteI am very glad to read your informative blog. thanks a lot for your valuable sharing..please keep update..
ReplyDeleteyou can also visit here linux training in india
Nice blog. Thanks for sharing. Its very informative and a great job. keep updating..
ReplyDeleteLinux Online Training
linux online course
Linux Online Training in Hyderabad
Linux Online Training in Bangalore
Linux Online Training in Chennai
I LOVE EMINEM AND MACRON.
ReplyDeleteME TOO .
DeleteI AM EMME.
I AM EMME AND I LOVE YOU ALL WITH BEAUTIFUL SMILE.
ReplyDeleteELIZABETH IS SPEAKING.
ReplyDeleteELIZABETH IS SPEAKING.
ReplyDeleteRESPECT.
OMAR SOLIMAN IS SPEAKING.
ReplyDeleteRESPECT.
ABDELFATTAH EL SISY IS SPEAKING.
ReplyDeleteRESPECT.
SARA OMAR SOLIMAN IS SPEAKING .
ReplyDeleteRESPECT.
RESPECT.
RESPECT.
GAMAL ABDELNASSER IS SPEAKING.
ReplyDeleteRESPECT.
RESPECT.
RESPECT.
SAAD ELDINELSHAZLY IS SPEAKING.
ReplyDeleteRESPECT.
FROM GLADIATOR TO ANOTHER ONE THAT CALLED BRAVE HEART AND LION HEART AND TRICKER GENTLEMAN RESPECT AND I LOVE YOU MORE AND MORE AND MORE.
ReplyDeleteAND I WANT TO TOUCH THE SUN WITH YOUR HAND,THIS IS NOT AN ORDER THIS IS AN INQUIREY ONLY. I LOVE YOU.
POTIN THE PRESIDENT OF RUSSIA IS SPEAKING.
ReplyDeleteRESPECT.
RESPECT.
RESPECT.
TRUMP THE PRESIDENT OF AMERICA IS SPEAKING.
ReplyDeleteRESPECT.
RESPECT.
RESPECT.
غموض ادراكى.
MARC FROM FACEBOOK GATE IS SPEAKING.
ReplyDeleteRESPECT.
MIRCLE THE PRESIDENT OF THE DUTSCHLAND IS SPEAKING.
ReplyDeleteRESPECT.
RESPECT.
RESPECT.
SEIFELDIN BIN SOLIMAN IS SPEAKING.
ReplyDeleteRESPECT.
RESPECT.
RESPECT.
NAGIB SAWIRAS IS SPEAKING.
ReplyDeleteRESPECT.