On Mon, Jan 17, 2011 at 20:36, Bakul Shah wrote: > On Mon, 17 Jan 2011 11:56:22 EST erik quanstrom  wrote: >> > strace tells you what system calls were made and when.  To >> > find out which functions use most time, compile with -pg and >> > look at the gprof output once done.  That 14 seconds were >> > probably spent computing dependencies.  You can convert your >> > test.mk to a Makefile with a trivial sed script. See what >> > bsdmake or gmake does with it time wise. {bsd,g}make have >> > been been abused with huge Makefiles for far longer and are >> > likely to be friendlier to them :-) >> >> why not just use prof, which is exactly the tool for the job? > > Ciprian specified plan9ports. Recipe for building a profiling > mk on unix: > >    cd $PLAN9/src/cmd/mk >    9 mk clean >    CC9="gcc -pg" 9 mk all > > Then: > >    mk=$PLAN9/src/cmd/mk/o.mk >    cd >    9 mk clean >    9 $mk >    gproff $mk > mk.gprof > > This will show where time is being spent. Actually I'm using the `mk` from `http://swtch.com/plan9port/unix/mk-with-libs.tgz` which I'm assuming is an extract of the `plan9port` sources. As such in order to build it I had to resort to updating the Makefile, but I didit. Attached is the output of running `gprof` as specified. Thanks, Ciprian.