Re: Invoke a prgram and calculate its process execution time through PHP?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



uthaya kumar wrote:
> Hi all,
> 
> I want to invoke one program through php. I just get
> the pid of that  file and calculate its execution
> time.
> 
> Guide me to invoke the program and calculate the
> cpu(process) execution time.

Uthaya:

What I ususally do is use a timer class.



<?php

//--------------------------------
//  Debug
//--------------------------------

class Debug
{
     function startTimer()
     {
         global $starttime;
         $mtime = microtime ();
         $mtime = explode (' ', $mtime);
         $mtime = $mtime[1] + $mtime[0];
         $starttime = $mtime;
     }
     function endTimer()
     {
         global $starttime;
         $mtime = microtime ();
         $mtime = explode (' ', $mtime);
         $mtime = $mtime[1] + $mtime[0];
         $endtime = $mtime;
         $totaltime = round (($endtime - $starttime), 5);
         return $totaltime;
     }
}


$Debug = new Debug;
$Debug->startTimer();


//page output here....

echp "<p>Page rendering time:&nbsp;". $Debug->endTimer() 
."&nbsp;seconds</p>";

?>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux