Re: Looking for a quick, easy way to time system process to the sub-second

2009-04-10 Thread John W. Krahn

Dan Huston wrote:

Greetings All:


Hello,

I have a script that I am using to run a series of sql statements 
against two different Oracle databases to compare performance based on a 
request from our DBAs.


I am currently using code like this:


 $time1 = time();
 $result = `$this_comm`;
 $time2 = time();
 $time_tot = $time2 - $time1;
but the problem that I have is that most of the queries complete in less 
than one second so I either need to rewrite the queries to make them run 
longer or I need a more fine grained timing sstem that would do sub 
second timing, preferably something in the stand perl distro.  Any 
suggestions?


Put the line:

use Time::HiRes 'time';

near the beginning of your program and it should do what you expect.



John
--
Those people who think they know everything are a great
annoyance to those of us who do.-- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Looking for a quick, easy way to time system process to the sub-second

2009-04-10 Thread Wagner, David --- Senior Programmer Analyst --- CFS
 -Original Message-
 From: Dan Huston [mailto:dan.hus...@domail.maricopa.edu] 
 Sent: Friday, April 10, 2009 11:24
 To: beginners@perl.org
 Subject: Looking for a quick, easy way to time system process 
 to the sub-second
 
 Greetings All:
 
 I have a script that I am using to run a series of sql statements 
 against two different Oracle databases to compare performance 
 based on a 
 request from our DBAs.
 
 I am currently using code like this:
 
   $time1 = time();
   $result = `$this_comm`;
   $time2 = time();
   $time_tot = $time2 - $time1;
 but the problem that I have is that most of the queries 
 complete in less 
 than one second so I either need to rewrite the queries to 
 make them run 
 longer or I need a more fine grained timing sstem that would do sub 
 second timing, preferably something in the stand perl distro.  Any 
 suggestions?

You could tie to Perl Benchmark and run x iterations. Add in
Time-HiRes and you should be able to get down to what you need.

Wags ;)
David R. Wagner
Senior Programmer Analyst
FedEx Freight
1.719.484.2097 TEL
1.719.484.2419 FAX
1.408.623.5963 Cell
http://fedex.com/us 


 
 Thanks
 Dan  
 
 

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/