freelanceprogrammers.org Forum Index » PHP

Invoke a prgram and calculate its process execution time thr


View user's profile Post To page top
uthayaa_p Posted: Fri Sep 23, 2005 10:20 am


Joined: 12 Apr 2005

Posts: 19
Invoke a prgram and calculate its process execution time thr
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.

Thanks and regards
uthaya

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Reply with quote
Send private message
View user's profile Post To page top
delvtecsol Posted: Fri Sep 23, 2005 6:16 pm


Joined: 29 Apr 2005

Posts: 10
Invoke a prgram and calculate its process execution time thr
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>";

?>
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help