lib/scripts/timestart.bash
author wenzelm
Wed, 01 Feb 2006 22:20:40 +0100
changeset 18888 3b643f81b378
parent 18364 a716d3b289ed
child 26576 fc76b7b79ba9
permissions -rw-r--r--
updated;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18317
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
     1
# -*- shell-script -*-
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
     2
# $Id$
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
     4
#
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
     5
# timestart - setup bash environment for timing.
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
     6
#
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
     7
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
     8
TIMES_RESULT=""
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
     9
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
    10
#set by configure
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
    11
AUTO_PERL=perl
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
    12
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
    13
function get_times () {
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
    14
  local TMP="/tmp/get_times$$"
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
    15
  times > "$TMP"   # No pipe here!
18364
a716d3b289ed avoid unportable tail;
wenzelm
parents: 18327
diff changeset
    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')"
18327
wenzelm
parents: 18322
diff changeset
    17
  rm -f "$TMP"
18317
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
    18
}
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
    19
bab988e37393 timestart - setup bash environment for timing;
wenzelm
parents:
diff changeset
    20
get_times  # sets TIMES_RESULT