From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rich Glazier Newsgroups: gmane.os.tru64.managers Subject: SUMMARY II: calculating elapsed time Date: Fri, 13 Feb 2004 12:32:53 -0800 (PST) Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <20040213203253.70369.qmail@web20722.mail.yahoo.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1076704423 27277 80.91.224.253 (13 Feb 2004 20:33:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 13 Feb 2004 20:33:43 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Fri Feb 13 21:33:36 2004 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 1Ark0F-0007CZ-00 for ; Fri, 13 Feb 2004 21:33:35 +0100 Original-Received: (qmail 8459 invoked by uid 5); 13 Feb 2004 20:33:23 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 8444 invoked by uid 49493); 13 Feb 2004 20:33:23 -0000 Original-Received: from rglazier2002@yahoo.com by sws1 by uid 49491 with qmail-scanner-1.16 (iscan: v3.1/v5.600-1011/622/49252. clamscan: 20030605. spamassassin: 2.55. Clear:SA:0(-1.3/5.0):. Processed in 20.895839 secs); 13 Feb 2004 20:33:23 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 13 Feb 2004 20:33:02 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.2-X17 #30669) with ESMTP id <0HT100LWNIF1QZ@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 13 Feb 2004 15:33:01 -0500 (EST) Original-Received: from web20722.mail.yahoo.com (web20722.mail.yahoo.com [216.136.226.76]) by emroute1.cind.ornl.gov (PMDF V6.2-X17 #30669) with SMTP id <0HT1001K7IET8W@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 13 Feb 2004 15:32:54 -0500 (EST) Original-Received: from [65.201.47.246] by web20722.mail.yahoo.com via HTTP; Fri, 13 Feb 2004 12:32:53 -0800 (PST) Original-To: tru64-unix-managers@ornl.gov Xref: main.gmane.org gmane.os.tru64.managers:6441 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:6441 > Thanks Charles.. Good catch! > > --- Charles Ballowe wrote: > > one suggestion... as it stands, there's nothing to > > prevent > > ELTIMEMIN from being greater than 60 -- after > > calculating > > hours, you might want > > ELTIMEMIN=$(( $ELTIMEMIN%60 )) > > > > On Fri, Feb 13, 2004 at 11:21:57AM -0800, Rich > > Glazier wrote: > > > Thanks to Bob Marcan, Charles Ballowe, Jeff > > Leafey, > > > Paul A. Sand, Martin Adolfsson, Tim Cutts, > Spider > > > Boardman, Peyton Bland, and J.A. Gutierrez . > > > > > > Perl seemed to be the favorite, and that is what > I > > > ended up using. A sampling of responses is > > included. > > > > > > Here is my script for a vdump | vrestore, and to > > clock > > > the time it took. I could precede the vdump > with > > the > > > ?time? command, but I like this better. > > > > > > #! /bin/ksh > > > # > > > DATE=`date +"%r %d %h %y (%a)"` > > > echo $DATE >> /usr/scripts/prod_on_mars.out > > > DATE1=`perl -e "print time()"` > > > /sbin/vdump -0f - /prod_on_mars | /sbin/vrestore > > -xf - > > > -D /prod > > > DATE2=`perl -e "print time()"` > > > ELTIME=$(( $DATE2 - $DATE1 )) > > > ELTIMEMIN=$(( $ELTIME/60 )) > > > ELTIMEHRS=$(( $ELTIMEMIN/60 )) > > > ELTIMESEC=$(( $ELTIME%60 )) > > > echo "Elapsed Time (h:m:s) = > > > $ELTIMEHRS:$ELTIMEMIN:$ELTIMESEC" >> > > > /usr/scripts/prod_on_mars.out > > > df -k /prod /prod2 >> > > /usr/scripts/prod_on_mars.out > > > echo > > > > > > "-----------------------------------------------------------------" > > > >> /usr/scripts/prod_on_mars.out > > > # > > > tail -49 /usr/scripts/prod_on_mars.out > > > /tmp/newfile > > > rm /usr/scripts/prod_on_mars.out > > > mv /tmp/newfile /usr/scripts/prod_on_mars.out > > > # > > > mailx -s "jupiter dump" . . . > > > > > > > > > RESPONSES: > > > ---------------------------------- > > > > > > you can always do > > > perl -e "print time" > > > > > > or to get a newline after it: > > > perl -e '$x=time; print "$x\n"' > > > > > > that will print seconds since epoch. > > > > > > Charles Ballowe > > > > > > ----------------------------------- > > > > > > Rich, > > > > > > You can install GNU date, but since you've > already > > got > > > Perl on board, > > > try something like: > > > > > > perl -e 'print time()' > > > > > > This returns the 'epoch' just like the %s flag > to > > GNU > > > date. > > > > > > Here's an example of using this to calculate the > > run > > > time of a program: > > > > > > START=`perl -e "print time()"` > > > ./program-to-test > > > END=`perl -e "print time()"` > > > ELAPSED=$(( $#ND - $START )) > > > echo "Program took $ELAPSED seconds to run" > > > > > > It's a bit of a kludge, but it does let you do > > what > > > you need without > > > installing anything else. Hope that helps! > > > -- > > > Jay Leafey > > > > > > -------------------------- > > > > > > I've always just used > > > > > > perl -e 'print time, "\n"' > > > > > > (well, suitably aliased.) > > > > > > -- > > > -- Paul A. Sand > > > > > > --------------------------- > > > > > > Hi, > > > > > > Using Perl: perl -e 'print time()."\n"' > > > > > > Good luck. > > > /Martin Adolfsson > > > > > > ---------------------------- > > > > > > It's actually the native way UNIX keeps time, so > > there > > > are any number > > > of ways to do it, all of which ultimately access > > the > > > kernel's internal > > > clock. Here's one way: > > > > > > perl -e 'print time(), "\n"' > > > > > > Tim Cutts > > > > > > --------------------------- > > > > > > perl -le 'print time' > > > > > > Spider Boardman > > > > > > > > > > > > --- Rich Glazier wrote: > > > > > > > > Does anyone have any good tricks for > calculating > > > > elapsed time in Tru64? Other OSes have a %s > > flag to > > > > the date command that is total elapsed Unix > time > > > > (since Jan 1 1970). Is there an equivilant in > > > > Tru64? > > > > > > > > Thanks, > > > > > > > > Rich > > > > > > > > __________________________________ > > > > Do you Yahoo!? > > > > Yahoo! Finance: Get your refund fast by filing > > > > online. > > > > http://taxes.yahoo.com/filing.html > > > > > > > > > __________________________________ > > > Do you Yahoo!? > > > Yahoo! Finance: Get your refund fast by filing > > online. > > > http://taxes.yahoo.com/filing.html > > > __________________________________ > Do you Yahoo!? > Yahoo! Finance: Get your refund fast by filing > online. > http://taxes.yahoo.com/filing.html > __________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html