Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 11-07-2001, 12:41 PM
Martz's Avatar
Martz Martz is offline
 
Join Date: Oct 2001
Location: UK
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How hard would it be to have how long it took mySQL and/or php to do their work for each page displayed?

Like if I was to do index.php?showqueries=1 I'd get:

Quote:
Page generated in 3.1261730194092 seconds with 30 queries,
spending 2.8116569519043 doing MySQL queries and 0.31451606750488 doing PHP things.
at the bottom of the page. Just a thought, its somewhich I'd like to include on my page - would anyone else?
Reply With Quote
  #2  
Old 11-07-2001, 12:43 PM
Reeve of shinra's Avatar
Reeve of shinra Reeve of shinra is offline
 
Join Date: Oct 2001
Location: NYC
Posts: 1,896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perhaps you already can do this, but it would be interesting to track the averages per forum from the admin panel for optimization purposes.
Reply With Quote
  #3  
Old 11-07-2001, 12:48 PM
Martz's Avatar
Martz Martz is offline
 
Join Date: Oct 2001
Location: UK
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had a quick look in my global.php (not admin) and there was a few references to the showqueries thing - nothing easily obvious for me to spot and hack though :/
Reply With Quote
  #4  
Old 11-07-2001, 12:52 PM
dirgotronix dirgotronix is offline
 
Join Date: Oct 2001
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

On my actual site, I have something like this in effect.

I used the following code to achieve this effect:

(from my index, the title is the following)
return $dirgotronix.net[content/News]; // 1.724 sec.

Here's the code:

PHP Code:
function getmicrotime(){ 
    list(
$usec$sec) = explode(" ",microtime()); 
    return ((float)
$usec + (float)$sec); 


// At the top of the page you're counting, put the following:
$begin_time getmicrotime();

// And at the bottom, this:
$end_time getmicrotime();
$load_time $end_time $begin_time;
echo 
number_format($load_time,3); 
You might be able the hack it a bit to accomidate the forum. That only echos the number of seconds to 3 decimal places, but that's all I needed on my site. Hope it's of some use!
Reply With Quote
  #5  
Old 11-07-2001, 03:02 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

its already added in to show queries instead of content just add &explain=1 to any vbulletin page, i think it should be able to be modified though to show content and queries instead of just the query info.
Reply With Quote
  #6  
Old 01-14-2002, 04:13 PM
Martz's Avatar
Martz Martz is offline
 
Join Date: Oct 2001
Location: UK
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thought I would bump this - I've chewed it over and not worked out how to do it. I still think it would be a great hack. However I don't especially need it, but I'm sometimes unsure if the forums are slow, or my connection is c**p. Its also nice to show off a quick server.

Any thoughts?
Reply With Quote
  #7  
Old 01-16-2002, 02:25 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In global.php (forum folder) replace:
Code:
if (isset($showqueries)) {
  $pagestarttime=microtime();
}
with:
Code:
// if (isset($showqueries)) {
  $pagestarttime=microtime();
// }
And now in functions.php (admin folder) replace:
Code:
  if ($showqueries) {
    $pageendtime=microtime();

    $starttime=explode(" ",$pagestarttime);
    $endtime=explode(" ",$pageendtime);

    $totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];

    $vartext.="<!-- Page generated in $totaltime seconds with $query_count queries -->";
  }
with:
Code:
//  if ($showqueries) {
    $pageendtime=microtime();

    $starttime=explode(" ",$pagestarttime);
    $endtime=explode(" ",$pageendtime);

    $totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];

    $vartext.="<!-- Page generated in $totaltime seconds with $query_count queries -->";
//  }
That will give you the info you want at the bottom of every HTML source code, in a <!-- comment --> (see this page's source code for example).

Adding it in the footer would require some more hacking (because the footer template is eval()'ed right when the script stats executing, so it doesn't have this info when it is eval()'ed).
Reply With Quote
  #8  
Old 01-16-2002, 08:45 PM
Martz's Avatar
Martz Martz is offline
 
Join Date: Oct 2001
Location: UK
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Damn thats great

Thanks for looking into that one, even if it isn't displayed on the page its a good thing to have imo. Good work!

Many thanks.
Reply With Quote
Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:10 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04487 seconds
  • Memory Usage 2,233KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete