lib/scripts/timestart.bash
author wenzelm
Thu, 01 Dec 2005 18:44:47 +0100
changeset 18322 56554bb23eda
parent 18317 bab988e37393
child 18327 1ee4523c831f
permissions -rw-r--r--
cpu time = user + system;

# -*- shell-script -*-
# $Id$
# Author: Makarius
#
# timestart - setup bash environment for timing.
#

TIMES_RESULT=""

#set by configure
AUTO_PERL=perl

function get_times () {
  local TMP="/tmp/get_times$$"
  times > "$TMP"   # No pipe here!
  TIMES_RESULT="$SECONDS $(tail -1 "$TMP" | "$AUTO_PERL" -pe 's,(\d+)m(\d+)\.\d+s +(\d+)m(\d+)\.\d+s, $1 * 60 + $2 + $3 * 60 + $4,e')"
  /bin/rm -f "$TMP"
}

get_times  # sets TIMES_RESULT