[ccache] how to use ccache

Mahmood NT nt_mahmood at yahoo.com
Sat Dec 8 06:35:21 GMT 2007


> 2- change this variable to invoke g++ through ccache:
>  CGAL_CXX = /usr/bin/ccache /usr/bin/g++

The  output of "make" was:
[mahmood at Milky-way VVc_diagram_2]$ make
/usr/bin/ccache /usr/bin/g++ -I../../include
 -I../../../Arrangement_2/include -ggdb -ftime-report -Wall
  '-I/home/mahmood/CGAL-3.2/include/CGAL/config/i686_Linux-2.6_g++-3.3.3' '-I/home/mahmood/CGAL-3.2/include'
  -I/usr/X11R6/include       -I/usr/lib/qt-3.3/include      
 -DCGAL_USE_CGAL_CORE    -c MD_demo.cpp
make: /usr/bin/ccache: Command not found
make: *** [MD_demo.o] Error 127

>1- change this to point to g++ without the path, and rely on the
 symlinks to
>   pick up /usr/bin/ccache instead of /usr/bin/g++

However this worked. But here is the result: 
First, before making:
[mahmood at Milky-way VVc_diagram_2]$ ccache -s
cache directory                     /home/mahmood/.ccache
cache hit                              0
cache miss                             0
no input file                          7
files in cache                         0
cache size                             0 Kbytes
max cache size                     976.6 Mbytes

Then I run "make" (Please note TIMES):
[mahmood at Milky-way VVc_diagram_2]$ make
g++
-I../../include -I../../../Arrangement_2/include -ggdb -ftime-report
-Wall
 
'-I/home/mahmood/CGAL-3.2/include/CGAL/config/i686_Linux-2.6_g++-3.3.3'
'-I/home/mahmood/CGAL-3.2/include'  -I/usr/X11R6/include     
-I/usr/lib/qt-3.3/include      -DCGAL_USE_CGAL_CORE    -c MD_demo.cpp
 
Execution times (seconds)
 TOTAL                 :   0.52             0.12             4.50
 
Execution times (seconds)
 garbage collection    :   1.19 ( 1%) usr   0.08 ( 0%) sys   3.50 ( 3%)
 wall
 cfg construction      :   0.35 ( 0%) usr   0.01 ( 0%) sys   0.50 ( 0%)
 wall
 cfg cleanup           :   0.10 ( 0%) usr   0.01 ( 0%) sys   0.50 ( 0%)
 wall
 trivially dead code   :   0.17 ( 0%) usr   0.02 ( 0%) sys   0.50 ( 0%)
 wall
 life analysis         :   0.89 ( 1%) usr   0.01 ( 0%) sys   2.50 ( 2%)
 wall
 life info update      :   0.44 ( 1%) usr   0.01 ( 0%) sys   0.50 ( 0%)
 wall
 preprocessing         :   1.36 ( 2%) usr   0.86 ( 4%) sys   3.00 ( 2%)
 wall
 lexical analysis      :   1.66 ( 2%) usr   2.16 ( 9%) sys   5.00 ( 4%)
 wall
 parser                :  20.06 (23%) usr   5.82 (25%) sys  33.00 (25%)
 wall
 name lookup           :  14.02 (16%) usr  13.70 (58%) sys  30.00 (22%)
 wall
 expand                :   2.17 ( 3%) usr   0.03 ( 0%) sys   2.50 ( 2%)
 wall
 varconst              :   0.90 ( 1%) usr   0.12 ( 1%) sys   2.00 ( 1%)
 wall
 integration           :   1.28 ( 1%) usr   0.02 ( 0%) sys   3.00 ( 2%)
 wall
 jump                  :   0.53 ( 1%) usr   0.06 ( 0%) sys   1.50 ( 1%)
 wall
 flow analysis         :   0.15 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 mode switching        :   0.41 ( 0%) usr   0.02 ( 0%) sys   1.50 ( 1%)
 wall
 scheduling            :   0.00 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 local alloc           :   1.18 ( 1%) usr   0.03 ( 0%) sys   1.00 ( 1%)
 wall
 global alloc          :   3.38 ( 4%) usr   0.04 ( 0%) sys   5.50 ( 4%)
 wall
 flow 2                :   0.36 ( 0%) usr   0.00 ( 0%) sys   0.50 ( 0%)
 wall
 machine dep reorg     :   0.00 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 shorten branches      :   0.81 ( 1%) usr   0.00 ( 0%) sys   0.00 ( 0%)
 wall
 reg stack             :   0.02 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 final                 :   1.74 ( 2%) usr   0.16 ( 1%) sys   2.00 ( 1%)
 wall
 symout                :  31.12 (36%) usr   0.25 ( 1%) sys  34.50 (26%)
 wall
 rest of compilation   :   1.73 ( 2%) usr   0.09 ( 0%) sys   0.50 ( 0%)
 wall
 TOTAL                 :  86.03            23.54           133.50
g++  -o MD_demo MD_demo.o
  '-L/home/mahmood/CGAL-3.2/lib/i686_Linux-2.6_g++-3.3.3'  -L/usr/X11R6/lib       -L/usr/lib/qt-3.3/lib
  -Wl,-R/home/mahmood/CGAL-3.2/lib/i686_Linux-2.6_g++-3.3.3:/usr/X11R6/lib:/usr/lib/qt-3.3/lib
  -lCGAL  -lcore++ -lCGALQt -lqt-mt  -lz   -lmpfr  -lgmpxx  -lgmp  -lX11
   -lm
g++
-I../../include -I../../../Arrangement_2/include -ggdb -ftime-report
-Wall
 
'-I/home/mahmood/CGAL-3.2/include/CGAL/config/i686_Linux-2.6_g++-3.3.3'
'-I/home/mahmood/CGAL-3.2/include'  -I/usr/X11R6/include     
-I/usr/lib/qt-3.3/include      -DCGAL_USE_CGAL_CORE    -c VVc_demo.cpp
In file included from /home/mahmood/CGAL-3.2/include/CGAL/config.h:35,
                 from /home/mahmood/CGAL-3.2/include/CGAL/basic.h:28,
                 from VVc_demo.cpp:28:
/home/mahmood/CGAL-3.2/include/CGAL/config/i686_Linux-2.6_g++-3.3.3/CGAL/compiler_config.h:312:1:
 warning: "CGAL_USE_GMP" redefined
VVc_demo.cpp:24:1: warning: this is the location of the previous
 definition
 
Execution times (seconds)
 TOTAL                 :   0.51             0.07             0.50
 
Execution times (seconds)
 garbage collection    :   1.79 ( 1%) usr   0.05 ( 0%) sys   2.50 ( 1%)
 wall
 cfg construction      :   0.47 ( 0%) usr   0.02 ( 0%) sys   0.50 ( 0%)
 wall
 cfg cleanup           :   0.09 ( 0%) usr   0.02 ( 0%) sys   0.00 ( 0%)
 wall
 trivially dead code   :   0.15 ( 0%) usr   0.00 ( 0%) sys   0.00 ( 0%)
 wall
 life analysis         :   1.22 ( 1%) usr   0.01 ( 0%) sys   4.00 ( 2%)
 wall
 life info update      :   0.51 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 preprocessing         :   1.38 ( 1%) usr   1.17 ( 4%) sys   2.00 ( 1%)
 wall
 lexical analysis      :   1.66 ( 1%) usr   1.82 ( 7%) sys   2.00 ( 1%)
 wall
 parser                :  25.97 (16%) usr   6.76 (25%) sys  32.50 (16%)
 wall
 name lookup           :  18.50 (11%) usr  16.23 (59%) sys  39.00 (19%)
 wall
 expand                :   3.23 ( 2%) usr   0.05 ( 0%) sys   3.50 ( 2%)
 wall
 varconst              :   1.02 ( 1%) usr   0.14 ( 1%) sys   1.00 ( 0%)
 wall
 integration           :   1.27 ( 1%) usr   0.00 ( 0%) sys   3.50 ( 2%)
 wall
 jump                  :   0.47 ( 0%) usr   0.06 ( 0%) sys   1.50 ( 1%)
 wall
 flow analysis         :   0.15 ( 0%) usr   0.03 ( 0%) sys   0.00 ( 0%)
 wall
 mode switching        :   0.54 ( 0%) usr   0.04 ( 0%) sys   1.00 ( 0%)
 wall
 scheduling            :   0.02 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 local alloc           :   1.51 ( 1%) usr   0.04 ( 0%) sys   2.00 ( 1%)
 wall
 global alloc          :   4.28 ( 3%) usr   0.06 ( 0%) sys   4.50 ( 2%)
 wall
 flow 2                :   0.57 ( 0%) usr   0.03 ( 0%) sys   0.00 ( 0%)
 wall
 machine dep reorg     :   0.02 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 shorten branches      :   0.95 ( 1%) usr   0.00 ( 0%) sys   0.50 ( 0%)
 wall
 reg stack             :   0.04 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 final                 :   2.57 ( 2%) usr   0.29 ( 1%) sys   1.00 ( 0%)
 wall
 symout                :  96.70 (58%) usr   0.40 ( 1%) sys 102.00 (50%)
 wall
 rest of compilation   :   2.20 ( 1%) usr   0.18 ( 1%) sys   3.00 ( 1%)
 wall
 TOTAL                 : 167.29            27.44           206.00
g++  -o VVc_demo VVc_demo.o
  '-L/home/mahmood/CGAL-3.2/lib/i686_Linux-2.6_g++-3.3.3'  -L/usr/X11R6/lib       -L/usr/lib/qt-3.3/lib
  -Wl,-R/home/mahmood/CGAL-3.2/lib/i686_Linux-2.6_g++-3.3.3:/usr/X11R6/lib:/usr/lib/qt-3.3/lib
  -lCGAL  -lcore++ -lCGALQt -lqt-mt  -lz   -lmpfr  -lgmpxx  -lgmp  -lX11
   -lm

Then I record statistics:
[mahmood at Milky-way VVc_diagram_2]$ ccache -s
cache directory                     /home/naderan/.ccache
cache hit                              0
cache miss                             2
not a C/C++ file                       2
no input file                          7
files in cache                         4
cache size                          51.4 Mbytes
max cache size                     976.6 Mbytes

Seems that ccache works!! :)
Then I change a file a little (for example "cout<<"..."; to cout <<
 "..." ;) and I run make again:
[mahmood at Milky-way VVc_diagram_2]$ make
make: Nothing to be done for `all'.
[mahmood at Milky-way VVc_diagram_2]$ rm *.o
[mahmood at Milky-way VVc_diagram_2]$ make
g++
-I../../include -I../../../Arrangement_2/include -ggdb -ftime-report
-Wall
 
'-I/home/mahmood/CGAL-3.2/include/CGAL/config/i686_Linux-2.6_g++-3.3.3'
'-I/home/mahmood/CGAL-3.2/include'  -I/usr/X11R6/include     
-I/usr/lib/qt-3.3/include      -DCGAL_USE_CGAL_CORE    -c MD_demo.cpp
make: *** [MD_demo.o] Interrupt
 
[mahmood at Milky-way VVc_diagram_2]$ make
g++
-I../../include -I../../../Arrangement_2/include -ggdb -ftime-report
-Wall
 
'-I/home/mahmood/CGAL-3.2/include/CGAL/config/i686_Linux-2.6_g++-3.3.3'
'-I/home/mahmood/CGAL-3.2/include'  -I/usr/X11R6/include     
-I/usr/lib/qt-3.3/include      -DCGAL_USE_CGAL_CORE    -c MD_demo.cpp
 
Execution times (seconds)
 TOTAL                 :   0.50             0.07             0.50
 
Execution times (seconds)
 garbage collection    :   1.18 ( 1%) usr   0.09 ( 0%) sys   1.00 ( 1%)
 wall
 cfg construction      :   0.25 ( 0%) usr   0.03 ( 0%) sys   0.50 ( 0%)
 wall
 cfg cleanup           :   0.10 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 trivially dead code   :   0.16 ( 0%) usr   0.00 ( 0%) sys   0.00 ( 0%)
 wall
 life analysis         :   0.96 ( 1%) usr   0.01 ( 0%) sys   1.00 ( 1%)
 wall
 life info update      :   0.37 ( 0%) usr   0.00 ( 0%) sys   0.00 ( 0%)
 wall
 preprocessing         :   1.31 ( 2%) usr   1.14 ( 5%) sys   6.00 ( 5%)
 wall
 lexical analysis      :   1.62 ( 2%) usr   2.14 ( 9%) sys   5.00 ( 4%)
 wall
 parser                :  19.36 (23%) usr   5.86 (25%) sys  27.50 (22%)
 wall
 name lookup           :  13.83 (16%) usr  13.17 (56%) sys  34.00 (28%)
 wall
 expand                :   2.29 ( 3%) usr   0.01 ( 0%) sys   2.50 ( 2%)
 wall
 varconst              :   0.67 ( 1%) usr   0.09 ( 0%) sys   0.50 ( 0%)
 wall
 integration           :   0.95 ( 1%) usr   0.00 ( 0%) sys   1.00 ( 1%)
 wall
 jump                  :   0.42 ( 0%) usr   0.07 ( 0%) sys   0.50 ( 0%)
 wall
 flow analysis         :   0.10 ( 0%) usr   0.04 ( 0%) sys   0.00 ( 0%)
 wall
 mode switching        :   0.55 ( 1%) usr   0.04 ( 0%) sys   0.50 ( 0%)
 wall
 scheduling            :   0.02 ( 0%) usr   0.00 ( 0%) sys   0.00 ( 0%)
 wall
 local alloc           :   1.23 ( 1%) usr   0.03 ( 0%) sys   1.00 ( 1%)
 wall
 global alloc          :   3.16 ( 4%) usr   0.03 ( 0%) sys   0.50 ( 0%)
 wall
 flow 2                :   0.42 ( 0%) usr   0.00 ( 0%) sys   0.50 ( 0%)
 wall
 machine dep reorg     :   0.01 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 shorten branches      :   0.84 ( 1%) usr   0.01 ( 0%) sys   1.50 ( 1%)
 wall
 final                 :   2.02 ( 2%) usr   0.19 ( 1%) sys   2.50 ( 2%)
 wall
 symout                :  31.25 (37%) usr   0.31 ( 1%) sys  32.50 (27%)
 wall
 rest of compilation   :   1.85 ( 2%) usr   0.16 ( 1%) sys   4.00 ( 3%)
 wall
 TOTAL                 :  84.92            23.44           122.50
g++  -o MD_demo MD_demo.o
  '-L/home/mahmood/CGAL-3.2/lib/i686_Linux-2.6_g++-3.3.3'  -L/usr/X11R6/lib       -L/usr/lib/qt-3.3/lib
  -Wl,-R/home/mahmood/CGAL-3.2/lib/i686_Linux-2.6_g++-3.3.3:/usr/X11R6/lib:/usr/lib/qt-3.3/lib
  -lCGAL  -lcore++ -lCGALQt -lqt-mt  -lz   -lmpfr  -lgmpxx  -lgmp  -lX11
   -lm
g++
-I../../include -I../../../Arrangement_2/include -ggdb -ftime-report
-Wall
 
'-I/home/mahmood/CGAL-3.2/include/CGAL/config/i686_Linux-2.6_g++-3.3.3'
'-I/home/mahmood/CGAL-3.2/include'  -I/usr/X11R6/include     
-I/usr/lib/qt-3.3/include      -DCGAL_USE_CGAL_CORE    -c VVc_demo.cpp
In file included from /home/mahmood/CGAL-3.2/include/CGAL/config.h:35,
                 from /home/mahmood/CGAL-3.2/include/CGAL/basic.h:28,
                 from VVc_demo.cpp:28:
/home/mahmood/CGAL-3.2/include/CGAL/config/i686_Linux-2.6_g++-3.3.3/CGAL/compiler_config.h:312:1:
 warning: "CGAL_USE_GMP" redefined
VVc_demo.cpp:24:1: warning: this is the location of the previous
 definition
 
Execution times (seconds)
 TOTAL                 :   0.51             0.07             0.50
 
Execution times (seconds)
 garbage collection    :   1.79 ( 1%) usr   0.05 ( 0%) sys   2.50 ( 1%)
 wall
 cfg construction      :   0.47 ( 0%) usr   0.02 ( 0%) sys   0.50 ( 0%)
 wall
 cfg cleanup           :   0.09 ( 0%) usr   0.02 ( 0%) sys   0.00 ( 0%)
 wall
 trivially dead code   :   0.15 ( 0%) usr   0.00 ( 0%) sys   0.00 ( 0%)
 wall
 life analysis         :   1.22 ( 1%) usr   0.01 ( 0%) sys   4.00 ( 2%)
 wall
 life info update      :   0.51 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 preprocessing         :   1.38 ( 1%) usr   1.17 ( 4%) sys   2.00 ( 1%)
 wall
 lexical analysis      :   1.66 ( 1%) usr   1.82 ( 7%) sys   2.00 ( 1%)
 wall
 parser                :  25.97 (16%) usr   6.76 (25%) sys  32.50 (16%)
 wall
 name lookup           :  18.50 (11%) usr  16.23 (59%) sys  39.00 (19%)
 wall
 expand                :   3.23 ( 2%) usr   0.05 ( 0%) sys   3.50 ( 2%)
 wall
 varconst              :   1.02 ( 1%) usr   0.14 ( 1%) sys   1.00 ( 0%)
 wall
 integration           :   1.27 ( 1%) usr   0.00 ( 0%) sys   3.50 ( 2%)
 wall
 jump                  :   0.47 ( 0%) usr   0.06 ( 0%) sys   1.50 ( 1%)
 wall
 flow analysis         :   0.15 ( 0%) usr   0.03 ( 0%) sys   0.00 ( 0%)
 wall
 mode switching        :   0.54 ( 0%) usr   0.04 ( 0%) sys   1.00 ( 0%)
 wall
 scheduling            :   0.02 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 local alloc           :   1.51 ( 1%) usr   0.04 ( 0%) sys   2.00 ( 1%)
 wall
 global alloc          :   4.28 ( 3%) usr   0.06 ( 0%) sys   4.50 ( 2%)
 wall
 flow 2                :   0.57 ( 0%) usr   0.03 ( 0%) sys   0.00 ( 0%)
 wall
 machine dep reorg     :   0.02 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 shorten branches      :   0.95 ( 1%) usr   0.00 ( 0%) sys   0.50 ( 0%)
 wall
 reg stack             :   0.04 ( 0%) usr   0.01 ( 0%) sys   0.00 ( 0%)
 wall
 final                 :   2.57 ( 2%) usr   0.29 ( 1%) sys   1.00 ( 0%)
 wall
 symout                :  96.70 (58%) usr   0.40 ( 1%) sys 102.00 (50%)
 wall
 rest of compilation   :   2.20 ( 1%) usr   0.18 ( 1%) sys   3.00 ( 1%)
 wall
 TOTAL                 : 167.29            27.44           206.00
g++  -o VVc_demo VVc_demo.o
  '-L/home/mahmood/CGAL-3.2/lib/i686_Linux-2.6_g++-3.3.3'  -L/usr/X11R6/lib       -L/usr/lib/qt-3.3/lib
  -Wl,-R/home/mahmood/CGAL-3.2/lib/i686_Linux-2.6_g++-3.3.3:/usr/X11R6/lib:/usr/lib/qt-3.3/lib
  -lCGAL  -lcore++ -lCGALQt -lqt-mt  -lz   -lmpfr  -lgmpxx  -lgmp  -lX11
   -lm
[mahmood at Milky-way VVc_diagram_2]$

 
As you can see in TOTAL section, there are differences in time, but
 some of them have increased!!!!! So what did ccache did really??

Sorry for long message
oops, I mistakenly send it private to  Francois, sorry
Mahmood NT
 
Mahmood NT



----- Original Message ----
From: Francois Marier <francois at debian.org>
To: Mahmood NT <nt_mahmood at yahoo.com>
Cc: ccache at lists.samba.org
Sent: Wednesday, December 5, 2007 11:47:53 AM
Subject: Re: [ccache] how to use ccache


On 2007-12-04 at 23:41:16, Mahmood NT wrote:
> This make file is a little bit long. First, one question? Is ccache
> dependant on makefile. This is not good....

Well, it is dependent on users configuring their system to compile with
ccache.  Normally, this happen automatically when you use the symlink
 trick
I wrote about earlier.

In this case, however, your makefile is explicitely requesting a
 specific
compiler:

> CGAL_CXX = /usr/bin/g++

If you want to use ccache, you need to either:

1- change this to point to g++ without the path, and rely on the
 symlinks to
   pick up /usr/bin/ccache instead of /usr/bin/g++

2- change this variable to invoke g++ through ccache:

  CGAL_CXX = /usr/bin/ccache /usr/bin/g++

Both of these methods are described in more details in the ccache
 manpage.
 
Francois





      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


More information about the ccache mailing list