RE: [PHP] Script Execution Time
This is what I use.. simple.. (someone from this list contributed it) function stopwatch_init() { list($usec, $sec) = explode( , microtime()); return ( (float)$usec + (float)$sec ); } Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -Original Message- From: Jeff Harris [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 9:17 AM To: Petya A Shushpanov Cc: Radek Zajkowski; PHP GENERAL Subject: Re: [PHP] Script Execution Time On Jul 29, 2003, Petya A Shushpanov claimed that: |? |class jTimer { |[snip] | |$timer-stop(); |echo round($timer-elapsed(),5); |? | |-- |Petya A Shushpanov | Or, you could use http://pear.php.net/package-info.php?package=Benchmark -- Registered Linux user #304026. lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Script Execution Time
Could someone pass on a snippet, a function or a technique for measuring script times. It appears the host I am with is having some PHP engine performance problems and I need to send them the figures. Thanks in advance R -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script Execution Time
Radek Zajkowski wrote: Could someone pass on a snippet, a function or a technique for measuring script times. It appears the host I am with is having some PHP engine performance problems and I need to send them the figures. Check out the user contributed notes on php.net for microtime(). http://us4.php.net/microtime - Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script Execution Time
* Thus wrote Radek Zajkowski ([EMAIL PROTECTED]): Could someone pass on a snippet, a function or a technique for measuring script times. It appears the host I am with is having some PHP engine performance problems and I need to send them the figures. So I'm suppose to take my timeout and search what was posted on this list (probably a dozen times within the last two months) then compose a message to the list and repeating what others have posted. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script Execution Time
Hi Radek, This has been posted before...around once every 2 weeks I guess :-)...check the archive or you will/may get flamed. Cheers, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script Execution Time
? class jTimer { var $start = 0; var $stop = 0; var $elapsed = 0; function start() { $this-start = microtime(); } function stop() { $this-stop= microtime(); } function elapsed() { if ($this-elapsed) { return $this-elapsed; } else { $start_u = substr($this-start,0,10); $start_s = substr($this-start,11,10); $stop_u = substr($this-stop,0,10); $stop_s = substr($this-stop,11,10); $start_total = doubleval($start_u) + $start_s; $stop_total = doubleval($stop_u) + $stop_s; $this-elapsed = $stop_total - $start_total; return $this-elapsed; } } } $timer = new jTimer; $timer-start(); #your code here $timer-stop(); echo round($timer-elapsed(),5); ? -- Petya A Shushpanov tel.: (+7 916) 556 16 27 mail: [EMAIL PROTECTED] site: www.eastof.ru - Original Message - From: Radek Zajkowski [EMAIL PROTECTED] To: PHP GENERAL [EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 1:09 AM Subject: [PHP] Script Execution Time Could someone pass on a snippet, a function or a technique for measuring script times. It appears the host I am with is having some PHP engine performance problems and I need to send them the figures. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Script Execution Time
Petya A Shushpanov mailto:[EMAIL PROTECTED] on Monday, July 28, 2003 3:41 PM said: ? class jTimer { [snip] } $timer = new jTimer; $timer-start(); #your code here $timer-stop(); echo round($timer-elapsed(),5); You could one up this class by creating another method that automatically performs the last line. i.e. $timer-stop(); $timer-report(); Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script Execution Time
Tnx. I`ve it fixed jet. - Original Message - From: Chris W. Parker [EMAIL PROTECTED] To: Petya A Shushpanov [EMAIL PROTECTED]; Radek Zajkowski [EMAIL PROTECTED]; PHP GENERAL [EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 3:50 AM Subject: RE: [PHP] Script Execution Time Petya A Shushpanov mailto:[EMAIL PROTECTED] on Monday, July 28, 2003 3:41 PM said: ? class jTimer { [snip] } $timer = new jTimer; $timer-start(); #your code here $timer-stop(); echo round($timer-elapsed(),5); You could one up this class by creating another method that automatically performs the last line. i.e. $timer-stop(); $timer-report(); Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script Execution Time
On Jul 29, 2003, Petya A Shushpanov claimed that: |? |class jTimer { |[snip] | |$timer-stop(); |echo round($timer-elapsed(),5); |? | |-- |Petya A Shushpanov | Or, you could use http://pear.php.net/package-info.php?package=Benchmark -- Registered Linux user #304026. lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script Execution Time
I have a php script that returns about 1.5Mb of data in text format to the user. I am wondering if there is a way for php to display the time it took to execute the script at the end of the file. Put this at the top of the script: code function getmicrotime(){ list($usec, $sec) = explode( ,microtime()); return ((float)$usec + (float)$sec); } $time_start = getmicrotime(); /code ..and this at the end: code $time_end = getmicrotime(); $time = $time_end - $time_start; $foo = round ($time, 2); echo Execution took $foo seconds.; /code Hope this helps. Best regards, Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]