zentara wrote:
> On Wed, 3 Aug 2005 03:00:01 -0700, [EMAIL PROTECTED] (Sara) wrote:
> 
> 
>>I have to test/optimize a script on a shared server. The script contains a 
>>couple of mySQL queries etc.
>>
>>Is there a way that I can see the query execution time (like in phymyAdmin) 
>>and total script execution time, plus memory & CPU usage? There are a lot of 
>>ways doing it in PHP but nothing in PERL/CGI? 
>>
>>I searched CPAN but failed to find my desired requirements. Are there any 
>>system commands that can be executed within the script to get these values.
>>
>>TIA.
>>
>>Sara.
> 
> 
> This should give you the idea. 
> 
> #!/usr/bin/perl -w
> sleep 5;
> print "This script took ". (time - $^T) .
>   " seconds in Perl $] on $^O\n";
> 
> 
> If you want to test just subs,  get a start time when entering
> the sub, and a finish time just before  the sub returns. Take the
> difference and you should have a pretty good indicator.
> 

Additionally if you are finding the time difference too small you can do
the same but with higher precision using Time::HiRes,

perldoc Time::HiRes

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to