Aleksandar Kuktin wrote:

        # ... yada yada yada ...
} 2>&1 | tee $SDIR/logs/$PROGRAM.log
time_elapsed=$(grep 'Elapsed Time' $SDIR/logs/$PROGRAM.log | \
   sed 's/^\([[:digit:]]\+\)\..*$/\1/');

# ...
echo "SBU: $(($time_elapsed / $standard_sbu))"

But no matter, the
infomation we need is inside the log file, so you just make a second
pass over the log file when all is done and extract the result.

Right. In my case, I happen to know that the line I need is the last one in the current log, so I use

buildtime=`tail -n1 $log|cut -f1 -d" "`

Note that the time output honors the TIMEFORMAT environment variable, so I am using TIMEFORMAT="%1R Elapsed Time - $TITLE", so I get for output something like '123.4 Elapsed Time - some title'

I then use bc to do the math and that gets a bit more accuracy, which helps especially for the packages that are less than 1 SBU.

sbu=`echo "scale=3; $buildtime / $base_sbu" | bc`

  -- Bruce
--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to