lib/scripts/timestart.bash
changeset 26576 fc76b7b79ba9
parent 18364 a716d3b289ed
child 29145 b1c6f4563df7
equal deleted inserted replaced
26575:042617a1c86c 26576:fc76b7b79ba9
     5 # timestart - setup bash environment for timing.
     5 # timestart - setup bash environment for timing.
     6 #
     6 #
     7 
     7 
     8 TIMES_RESULT=""
     8 TIMES_RESULT=""
     9 
     9 
    10 #set by configure
       
    11 AUTO_PERL=perl
       
    12 
       
    13 function get_times () {
    10 function get_times () {
    14   local TMP="/tmp/get_times$$"
    11   local TMP="/tmp/get_times$$"
    15   times > "$TMP"   # No pipe here!
    12   times > "$TMP"   # No pipe here!
    16   TIMES_RESULT="$SECONDS $(echo $(cat "$TMP") | "$AUTO_PERL" -pe 's,\d+m\d+\.\d+s \d+m\d+\.\d+s (\d+)m(\d+)\.\d+s +(\d+)m(\d+)\.\d+s, $1 * 60 + $2 + $3 * 60 + $4,e')"
    13   TIMES_RESULT="$SECONDS $(echo $(cat "$TMP") | perl -pe 's,\d+m\d+\.\d+s \d+m\d+\.\d+s (\d+)m(\d+)\.\d+s +(\d+)m(\d+)\.\d+s, $1 * 60 + $2 + $3 * 60 + $4,e')"
    17   rm -f "$TMP"
    14   rm -f "$TMP"
    18 }
    15 }
    19 
    16 
    20 get_times  # sets TIMES_RESULT
    17 get_times  # sets TIMES_RESULT