bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] maint.mk: print the elapsed time for each syntax-check rule


From: Pádraig Brady
Subject: Re: [PATCH] maint.mk: print the elapsed time for each syntax-check rule
Date: Tue, 13 Apr 2010 09:41:32 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

On 12/04/10 17:51, Eric Blake wrote:
> On 04/11/2010 03:31 AM, Jim Meyering wrote:
>> This patch does something I've wanted for a while.
>> It prints the elapsed time for each individual syntax-check rule.
>>
>> I don't particularly like the fact that each new rule
>>   - uses a temporary .sc-start-* file in which it saves each start time
>>   - uses awk to compute the difference of two floating point numbers
>>
>> Initially I used "bc" to compute the difference, but that was overkill.
>> The way I'm using awk isn't pretty, especially considering that
>> most modern shells can do "$[end - start]", but it works.
> 
> $[] is not portable; $(()) is the POSIX-preferred variant that even more
> shells support.  And we already make a lot of assumptions in maint.mk
> that maintainers have a POSIX shell (that is, I seriously doubt that
> Solaris /bin/sh would work with maint.mk), in part because we are also
> guaranteed that GNU make is running if maint.mk is even in use.
> 
> I haven't looked closely at the patch yet, for possible improvements,
> but I am pleased with the idea of listing elapsed times (it will
> probably show up even more on cygwin to help expose places where
> reducing the number of forks makes sense).

$(()) and $[] work on ints only, which I suppose could be hacked like:

ts1=$(printf "%.2f\n" $(date +%s.%N) | tr -d .)
sleep 1.5
ts2=$(printf "%.2f\n" $(date +%s.%N) | tr -d .)
echo $(($ts2 - $ts1)) | sed 's/\(..\)$/.\1/'

I noticed with `make syntax-check -j1` the start and end times are interspersed,
while with -j2 they're separated, which is fine, just an observation.
Also in the -j>1 case all elapsed times are much greater due to the
way make is processed.

cheers,
Pádraig.




reply via email to

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