Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

Reply
 
Thread Tools
VB3 MicroStats Details »»
VB3 MicroStats
Version: 1.00, by TECK TECK is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 03-04-2004 Last Update: Never Installs: 157
 
No support by the author.

You asked for... but it was available for VB2 only? There you go, you have it now.

Looking for 3.5.4 version? Get it here.

VERSION 1.2 RELEASED
Basically the only difference you will notice is a dropdown menu that will display the unchached templates.
In this way, you can add it to the cache and save one or more queries.


[high]THIS HACK WAS TESTED IN A DEFAULT, CODE UNMODIFIED BOARD.[/high]

This hack will add at the bottom of each vBulletin(powered) page the following stats:
REGULAR USERS STATS
- load time of specified page in microseconds (with custom no. of digits to show)
- percentages of PHP/MySQL usage
- number of queries executed

ADMINISTRATOR STATS
- number/name of uncached templates (name highlighted in blue, for uncached template)
- vBulletin DEBUG mode status
- server GZIP library compression status
- average Server Loads

[high]This is not only estethic, it will also help you troubleshoot any wierd queries that you have in your scripts.[/high]

IMPORTANT
If you get results like:
Page generated in 3.35731196 seconds (9.05% PHP - [high]90.95%[/high] MySQL) with 17 queries
You probably use a bad piece of code, because vBulletin will never generate those extreme results.
Imagine this: the code uses only 10% the resources to read the actual PHP code and the rest of 90% is used only to scan the tables... WOW!
That means the code forces to read into the database for each user who visits the site at this percentage... if you have 1000 users viewing the page in the same time.. you can get a picture of it...
If you compare this with vBulletin, the software does the opposite, 90% PHP and 10% MySQL... the right way.

DIVISION BY ZERO ERROR? Read this.
INVALID STATS IF MYSQL COMPILED IN A NON-ENGLISH LANGUAGE? Read this.

NOTE: The blue highlighting is not working in Opera 7.23 version. (Thanks Christine)

Have fun.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #92  
Old 04-05-2004, 03:37 AM
neocorteqz's Avatar
neocorteqz neocorteqz is offline
 
Join Date: May 2002
Location: Barefoot Bay Fl
Posts: 473
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the update, Now i don't have any uncached templates, but if i did, how would i go about adding it to the list of cached templates?? Just asking for a push in the right direction, not the outright answer, unless it really is that simple.

thanks again.
Reply With Quote
  #93  
Old 04-05-2004, 05:50 AM
Oblivion Knight's Avatar
Oblivion Knight Oblivion Knight is offline
 
Join Date: May 2002
Location: Sheffield, UK
Posts: 1,757
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the update TECK, however your instructions still say Version 1.1
Reply With Quote
  #94  
Old 04-05-2004, 08:34 AM
djohn djohn is offline
 
Join Date: Feb 2004
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

TECK, how can I update from version 1.1?
Reply With Quote
  #95  
Old 04-05-2004, 11:29 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The change is listed in file: FORUM/includes/functions.php (1 change more exacly).
Look at the old 1.1 file and replace the code with the new one.

Cheers.
Reply With Quote
  #96  
Old 04-05-2004, 11:44 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To update from v1.1 to v1.2, do the following:

In functions.php, find:

PHP Code:
        $mstemplates 'NO Uncached Templates | ';
        if (
$_TEMPLATEQUERIES)
        {
            
$mstemplates '<b>' sizeof($_TEMPLATEQUERIES) . '</b> Uncached ';
            
$mstemplates .= iif(sizeof($_TEMPLATEQUERIES) != '1''Templates''Template') . ' | ';
        } 
REPLACE it with:

PHP Code:
        $mstemplates '<select size="1" style="font-size: 10px">' "\n";
        
        if (
$_TEMPLATEQUERIES)
        {
            
$mstemplates .= '<option>' sizeof($_TEMPLATEQUERIES) . ' Uncached Template';
            
$mstemplates .= iif(sizeof($_TEMPLATEQUERIES) != '1''s') . '</option>';

            if (
is_array($tempusagecache))
            {
                global 
$vbcollapse;

                
ksort($tempusagecache);
                foreach (
$tempusagecache AS $tempname => $times)
                {
                    if (
$_TEMPLATEQUERIES["$tempname"])
                    {
                        
$mstemplates .= '<option class="alt2">' $tempname ' (' $times ')</option>';
                    }
                    else
                    {
                        
$mstemplates .= '<option>' $tempname ' (' $times ')</option>';
                    }
                }
            }
        }
        else
        {
            
$mstemplates .= '<option>NO Uncached Templates</option>';
        }
        
$mstemplates .= '</select>'
Thanks, Floren, for the update. I only posted this to help you out with all of the messages you'll get wanting to know how to update this great hack.
Reply With Quote
  #97  
Old 04-05-2004, 03:12 PM
Zelda-King's Avatar
Zelda-King Zelda-King is offline
 
Join Date: Nov 2002
Location: London, England
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Using the code Boofo posted there is no space between the dropdown and the DEBUG status. Just a little thing but I think a space there would make it look better.
Reply With Quote
  #98  
Old 04-05-2004, 03:51 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

All I did was post what was changed in the file.
Reply With Quote
  #99  
Old 04-05-2004, 04:06 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
Thanks, Floren, for the update. I only posted this to help you out with all of the messages you'll get wanting to know how to update this great hack.
Bob, be aware, there are some other changes in the functions.php code beside the code you posted, like for example you need to globalize certain new variables...
Look at the global line there.
If I would be you, I would replace, in functions.php, the first block of code (first change) to make sure there is no confusion:
Code:
function print_output($vartext, $sendheader = 1)
{
	global $pagestarttime, $query_count, $querytime, $DB_site, $bbuserinfo;
	global $vbphrase, $vboptions, $stylevar, $_REQUEST, $_TEMPLATEQUERIES, $tempusagecache, $debug, $nozip, $ms;

	$pageendtime = microtime();

	// Number of decimals to show for microtime (ex 0.15227890)
	$msdecimal = '8';

	if ($vboptions['addtemplatename'])
	{
		if ($doctypepos = strpos($vartext, $stylevar['htmldoctype']))
		{
			$comment = substr($vartext, 0, $doctypepos);
			$vartext = substr($vartext, $doctypepos + strlen($stylevar['htmldoctype']));
			$vartext = $stylevar['htmldoctype'] . "\n" . $comment . $vartext;
		}
	}

	$starttime = explode(' ', $pagestarttime);
	$endtime = explode(' ', $pageendtime);
	$totaltime = vb_number_format($endtime[0] - $starttime[0] + $endtime[1] - $starttime[1], $msdecimal);

	$msphp = vb_number_format(((($totaltime - $querytime) / $totaltime) * 100), 2) . '% PHP';
	$mssql = vb_number_format((($querytime / $totaltime) * 100), 2) . '% MySQL';

	$ms = '<tr align="right">' . "\n";
	$ms .= '		<td class="tcat"' . iif($vboptions['allowchangestyles'], ' colspan="2"') . '><div class="smallfont">';
	$ms .= 'Page generated in ' . $totaltime . ' seconds (' . $msphp . ' - ' . $mssql . ') with ';
	$ms .= $query_count . ' queries</div></td>' . "\n";
	$ms .= '</tr>' . "\n";

	if ($bbuserinfo['usergroupid'] == '6')
	{
		$mstemplates = '<select size="1" style="font-size: 10px">' . "\n";
		
		if ($_TEMPLATEQUERIES)
		{
			$mstemplates .= '<option>' . sizeof($_TEMPLATEQUERIES) . ' Uncached Template';
			$mstemplates .= iif(sizeof($_TEMPLATEQUERIES) != '1', 's') . '</option>';

			if (is_array($tempusagecache))
			{
				global $vbcollapse;

				ksort($tempusagecache);
				foreach ($tempusagecache AS $tempname => $times)
				{
					if ($_TEMPLATEQUERIES["$tempname"])
					{
						$mstemplates .= '<option class="alt2">' . $tempname . ' (' . $times . ')</option>';
					}
					else
					{
						$mstemplates .= '<option>' . $tempname . ' (' . $times . ')</option>';
					}
				}
			}
		}
		else
		{
			$mstemplates .= '<option>NO Uncached Templates</option>';
		}
		$mstemplates .= '</select>';

		$msdebug = 'DEBUG Mode OFF | ';
		if ($debug)
		{
			$msdebug = 'DEBUG Mode ON | ';
		}

		$msgzip = 'GZIP OFF | ';
		if ($vboptions['gzipoutput'] AND !$nozip)
		{
			$msgzip = 'GZIP ON (level ' . $vboptions['gziplevel'] . ') | ';
		}

		$msserver = '';
		if ($stats = @exec('uptime 2>&1') AND trim($stats) != '')
		{
			if (preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $stats, $regs))
			{
				$regs[1] = vb_number_format($regs[1], 2);
				$regs[2] = vb_number_format($regs[2], 2);
				$regs[3] = vb_number_format($regs[3], 2);

				$msserver = '<b>' . $regs[1] . '</b> : ' . $regs[2] . ' : ' . $regs[3] . ' | ';
			}
		}

		$ms .= '<tr align="right">' . "\n";
		$ms .= '		<td class="alt1"' . iif($vboptions['allowchangestyles'], ' colspan="2"') . '><div class="smallfont">';
		$ms .= $msdebug . $msgzip . $msserver . $mstemplates . '</div></td>' . "\n";
		$ms .= '</tr>' . "\n";
	}

	if (DB_QUERIES)
	{
		$ms = '';
		$vartext .= "<!-- Page generated in " . $totaltime . " seconds with $query_count queries -->";
	}
 
	// ####################################################################
	// temporary code
	global $DEVDEBUG, $_SERVER;
	if ($debug)
	{
That will fix the space issue mentioned before by other people as well globalize the templates cache, $tempusagecache.
Let me know if that makes sense. Thanks Bob.
Reply With Quote
  #100  
Old 04-05-2004, 04:12 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, thanks. I was just trying to help. I guess I should have looked for more changes.
Reply With Quote
  #101  
Old 04-05-2004, 04:14 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
Ok, thanks. I was just trying to help...
And I hope you will keep on doing this.
You helped me several times in my threads with bugs, etc. as well others.
Reply With Quote
Reply

Thread Tools

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 11:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05491 seconds
  • Memory Usage 2,333KB
  • Queries Executed 25 (?)
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)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete