General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old December 21st, 2002, 05:31 PM
Vasarab69 Vasarab69 is offline
Goldmember
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 71 Vasarab69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 6
Send a message via AIM to Vasarab69
Post microtime

hey i just wanted to return like a microtime value for the amount of microseconds it takes to load any given page...heres the code:

PHP Code:
function getmicrotime() {
    
$mtime=microtime();
    
$mtime=explode(" "$mtime);
    
$mtime=$mtime[1] + $mtime[0];
    return 
$mtime;



and its basically returning a blank, nothings coming up...any ideas fellas?
__________________
-Alexander

Reply With Quote
  #2  
Old December 21st, 2002, 05:53 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 6
PHP Code:
function bench_it()
    {
    
$mtime explode' 'microtime() );
    
$msec = ( double ) $mtime[0];
    
$sec = ( double ) $mtime[1];
    return 
$sec $msec;
}

$st_bnch bench_it();
/*
   Your application code
*/
$en_bnch bench_it(); 

The above will bind the start and end time to said scalars. To show just the microseconds, use this format ->
PHP Code:
 $runtime $en_bnch $st_bnch;
echo 
$runtime

If you wanna display a more readable format, use (or something simular) ->
PHP Code:
 $runtime round$en_bnch $st_bnch);
echo( 
'Page execution took ' $runtime ' seconds.' ); 

Chow...
__________________
~ Joe Penn

We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?

Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.




Reply With Quote
  #3  
Old December 21st, 2002, 06:08 PM
Vasarab69 Vasarab69 is offline
Goldmember
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 71 Vasarab69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 6
Send a message via AIM to Vasarab69
thanks a lot

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > microtime


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway