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: Paolo Bonzini
Subject: Re: [PATCH] maint.mk: print the elapsed time for each syntax-check rule
Date: Wed, 14 Apr 2010 07:52:07 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.3

On 04/13/2010 10:41 AM, Pádraig Brady wrote:
> 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/'

Or somewhat creatively:

ts1=$(date +%s%N); ts1=${ts1%???????}
sleep 0.5
ts2=$(date +%s%N); ts2=${ts2%???????}
ts=$(($ts2 - $ts1 + 100))
echo $((${ts%??} - 1)).${ts:$((${#ts}-2))}

The last line is only half serious, but the first one is actually practical to use.

Paolo




reply via email to

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