help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debugging parallel make


From: John Graham-Cumming
Subject: Re: debugging parallel make
Date: Mon, 07 Jan 2008 09:31:05 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan McMahill wrote:
> is there an easy way to get some sort of log which clearly shows what
> commands (but not their outputs) are running at the same time during
> each part of a parallel make job?

It's hard (there are commercial tools like Electric Cloud that can get
deep into exactly what's happening when), but one simple thing to do in
GNU Make is to get start timing information for commands.  Here's how to
do it:

AT = @date +"$@: %s" ;

all: foo bar

foo:
        $(AT)sleep 5

bar:
        $(AT)sleep 10

I've replaced the standard @ prefix on commands with $(AT).  This gets
expanded and includes a call to GNU date to output the name of the
target being build followed by the epoch time.  Here's the output for
serial and parallel make:

$ make
foo: 1199694571
bar: 1199694576

$ make -j2
foo: 1199694592
bar: 1199694592

Hope that helps.  If you need subsecond timing then you'd need to wrap
gettimeofday(2) in a small C program and use it to output timing
information.   If you need end times then you could suffix each command
with something like:

END = ; date +"$@: %s"

John.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHgeNJLphrp73n/hARAsVEAJwM0lwZlJFDtRuWiIXTIne+SehosQCfRJzb
olPVCW+OyudLMnD7SI4gPho=
=qCW+
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]