I have been working with the Eclipse build a lot lately. It takes about 18 minutes to build eclipse on my laptop so every time I made a change to the rpm or the build scripts I had to wait 18 minutes to see the results.
So I wanted to speed the build up. I was under the impression that the eclipse build was IO bound so to speed that up I decided to use . I created a virtual machine with tons of memory and allocated a 4GB folder:
mkdir /tmp/build mount -t ramfs -o size=8g ramfs /tmp/build
There was no speed up. And I had made sure that there was no swapping.
So after digging around a little bit I found a way to analyse the build better. At first I had wanted to use
but I discovered dstat.
dstat has an output which is easier to parse for graphic tools:
$ dstat -tc ----system---- ----total-cpu-usage---- time |usr sys idl wai hiq siq 29-11 09:34:12| 4 2 92 1 0 0 29-11 09:34:13| 4 2 91 2 1 0
The each line in the output tells it what percentage of the time since the last sample your cpu spent running user process, system process, idling, waiting for io respectively. I don’t really know what the last two values are.
So I ran:
dstat -tc >& dstat.raw
In retrospect I really did not need to sample ever second and should have run
dstat -tc 5 >& dstat.raw
to sample every 5 seconds.
So I imported dstat.raw into gnumeric and ta-da!:
The important colours above graph are the yellow (idling cpu) the blue (cpu executing eclipse build) and the turquoise (cpu waiting for io). The first thing you will notice is that there is not a lot of io blockage. Of note are the big peak in the beginning which I assume is the extraction of the sources tar ball and at the end which I assume is the writing of the rpms. The second thing you’ll notice is that there is a lot of high yellow which is evidence to the fact that my cpu’s spend most of the time idling during the build. Finally you’ll note that the blue never goes above 25% and is usually around 20%. This is because I have 4 cpu’s and the eclipse build is not parallelized.
So in conclusion eclipse build is cpu bound, and the most obvious solution to this is to make the build parallel where possible.