Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

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

Version: 3.5.4 Rating:
Released: 05-18-2006 Last Update: 05-21-2006 Installs: 92
Uses Plugins Template Edits
Code Changes  
No support by the author.

Finally, the vBMicroStats product for vBulletin 3.5.4 is here.
The previous versions of my mod were very solicited by vBulletin administrators...
I hope you will enjoy this new version as much you did the other ones.

Looking for VB 3.6.x version? It is here.

This mod with add at the bottom of each vBulletin (powered) page, the statistics listed below.
Also, it will help you troubleshoot and optimize your vBulletin board by viewing or comparing PHP/MySQL options and other statistics that are normally hidden in your forum pages.

Regular Users:
? Load time of specified page in microseconds
? Number of queries executed
? PHP percent page usage
? MySQL percent page usage

Administrators Only:
? Server memory usage per page (in Kb)
? DEBUG mode status
? Browser GZIP library compression status
? Server average loads
? Uncached templates (useful to troubleshoot the code)

The code modifications listed below were tested into a clean installed vBulletin board. They work 100%.
If you encounter any problems, feel free to post your questions here.

Step by step install instructions are posted into vbmicrostats.html file.
In order to perform an efficient modification of your files, I recommend you to use Dreamweaver (Coder Mode) or Textpad.
Both editors will allow you to complete all steps without any coding errors.

I tried to use the plugin system as much as I could, in order to avoid any unnecessary code modifications.
In order to set the right query execution time, you will need to perform 2 small code changes to each of the following files:
? class_core.php (folder /includes)
? init.php (folder /includes)

The code changes are very safe and designed not to interfere in any way with the vBulletin performance/functionality.
Make sure you modify, save and upload one file at the time to your server.
Then, simply run the product-plugin_vbmicrostats.xml file.

Once the product installed, don't forget to enable it.
Go to your vBulletin Options, click on BB MicroStats setting group and set all your options.

Show Your Support

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

Comments
  #22  
Old 05-19-2006, 04:49 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, here it is an example:
Code:
	$ms_output  = '<span class="smallfont">';
	$ms_output .= 'Page generated in ' . $total_time . ' seconds (' . $php_percent . ' - ' . $sql_percent . ') with ' . $query_count . ' queries';
	$ms_output .= '</span><br />' . "\n";

	[... code here, don't edit ...]

		$ms_output .= '<span class="smallfont">';
		$ms_output .= $memory_status . $debug_status . $gzip_status . $server_status . $templates_status;
		$ms_output .= '</span>' . "\n";
The mod will remove the table rows and display it as 2 regular text lines.
If you want the $ms_output template code even simplier, use this:
Code:
	$ms_output = 'Page generated in ' . $total_time . ' seconds (' . $php_percent . ' - ' . $sql_percent . ') with ' . $query_count . ' queries<br />';

	[... code here, don't edit ...]

		$ms_output .= $memory_status . $debug_status . $gzip_status . $server_status . $templates_status;
Then you can simply play with the regular template code:
Code:
<if condition="$show['microstats']">{microstats}</if>
the way you like it.
For example, to make your two new lines centered, use this:
Code:
<if condition="$show['microstats']">
	<div style="text-align: center;">{microstats}</div>
</if>
Let me know if I was clear...
If you have any other questions, go ahead and post them.
Reply With Quote
  #23  
Old 05-19-2006, 04:50 AM
EasyTarget EasyTarget is offline
 
Join Date: Nov 2004
Posts: 660
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is there a way to track down which hacks are the troublesome ones using this?
Reply With Quote
  #24  
Old 05-19-2006, 04:50 AM
DementedMindz DementedMindz is offline
 
Join Date: Jan 2006
Posts: 1,474
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

much easier thank you
Reply With Quote
  #25  
Old 05-19-2006, 04:54 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bob, I looked at your site, it looks fine?
If you want to place the microstats after the vBulletin copyright (for example), use my second $ms_output template, listed above.
Reply With Quote
  #26  
Old 05-19-2006, 04:55 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DementedMindz
much easier thank you
Now, post a better explained tutorial, since you done it.
And a screenshot.
Reply With Quote
  #27  
Old 05-19-2006, 05:00 AM
DementedMindz DementedMindz is offline
 
Join Date: Jan 2006
Posts: 1,474
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

one sec im just moving around the text lol tryin to see where it looks best
Reply With Quote
  #28  
Old 05-19-2006, 05:03 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by EasyTarget
is there a way to track down which hacks are the troublesome ones using this?
Unfortunatelly no. vBMicroStats analyses the php page in ensemble, then spits the results.
However, there is a tricky way to see what's the "bad" mod in your source.
You need to enable only one mod at the time. Then simply view your pages with the specific mod enabled/disabled.

Compare your stats between the original vBulletin unmodded page and the one with the mod enabled. You will notice rightaway and erratic number of extra queries or abnormal percentages.... and complain to the mod creator.

That's why the users loved so much vBMicroStats, it was the first mod that told you what's really going on with your PHP code...
If you find a better way, please share it with the users here.
Reply With Quote
  #29  
Old 05-19-2006, 05:09 AM
DementedMindz DementedMindz is offline
 
Join Date: Jan 2006
Posts: 1,474
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok quick question here is what i have so far...

Code:
if ($vbulletin->options['vb_mstats_active'])
{
	$colspan = 1;
	if ($show['quickchooser'])
	{
		$colspan++;
	}
	if ($show['languagechooser'])
	{
		$colspan++;
	}

	$page_endtime = microtime();
	$start_time = explode(' ', $pagestarttime);
	$end_time = explode(' ', $page_endtime);
	$total_time = vb_number_format($end_time[0] - $start_time[0] + $end_time[1] - $start_time[1], $vbulletin->options['vb_mstats_decimal']);

	$query_time = $vbulletin->db->mstime_total;
	$query_count = $vbulletin->db->querycount;

	$php_percent = vb_number_format(((($total_time - $query_time) / $total_time) * 100), 2) . '% PHP';
	$sql_percent = vb_number_format((($query_time / $total_time) * 100), 2) . '% MySQL';

	$ms_output .= '		<span class="smallfont">Page generated in ' . $total_time . ' seconds (' . $php_percent . ' - ' . $sql_percent . ') with ' . $query_count . ' queries</span>' . "\n";

	if ($vbulletin->options['vb_mstats_adminactive'] AND $vbulletin->userinfo['usergroupid'] == 6)
	{
		$memory_status = '';
		if ($vbulletin->options['vb_mstats_memory'])
		{
			if (!function_exists('memory_get_usage'))
			{
				function memory_get_usage()
				{
					$mem_output = array();
					if (strtolower(substr(PHP_OS, 0, 3)) == 'win')
					{
						exec('tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $mem_output);
						return preg_replace( '/[^0-9]/', '', $output[5] ) * 1024;
					}
					else
					{
						$pid = getmypid();
						exec("ps -eo%mem,rss,pid | grep $pid", $mem_output);
						$mem_output = explode(' ', $mem_output[0]);
						return $mem_output[1] * 1024;
					}
				}
			}
			$memory_status = vb_number_format((memory_get_usage() / 1024), 2) . 'KB Used | ';
		}

		$debug_status = '';
		if ($vbulletin->options['vb_mstats_debug'])
		{
			$debug_status = 'DEBUG Mode OFF | ';
			if ($vbulletin->debug)
			{
				$debug_status = 'DEBUG Mode ON | ';
			}
		}

		$gzip_status = '';
		if ($vbulletin->options['vb_mstats_gzip'])
		{
			$gzip_status = 'GZIP OFF | ';
			if ($vbulletin->options['gzipoutput'] AND !$vbulletin->nozip)
			{
				$gzip_status = 'GZIP ON (level ' . $vbulletin->options['gziplevel'] . ') | ';
			}
		}

		$server_status = '';
		if ($vbulletin->options['vb_mstats_server'])
		{
			if ($stats = @exec('uptime 2>&1') AND trim($stats) != '' AND preg_match("#: ([\d.,]+),?\s+([\d.,]+),?\s+([\d.,]+)$#", $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);
				$server_status = '<strong>' . $regs[1] . '</strong> : ' . $regs[2] . ' : ' . $regs[3] . ' | ';
			}
		}

		$templates_status = '';
		if ($vbulletin->options['vb_mstats_templates'])
		{
			$templates_status = 'NO Uncached Templates';
			if ($_TEMPLATEQUERIES)
			{
				$templates_status  = '<select class="smallfont" size="1">' . "\n";
				$templates_status .= '<optgroup label="Uncached Templates: ' . sizeof($_TEMPLATEQUERIES) . '">' . "\n";
				if (is_array($tempusagecache))
				{
					global $vbcollapse;
	
					ksort($tempusagecache);
					foreach ($tempusagecache AS $tempname => $times)
					{
						if ($_TEMPLATEQUERIES["$tempname"])
						{
							$templates_status .= '<option class="alt2" selected="selected">' . $tempname . ' (' . $times . ')</option>' . "\n";
						}
						else
						{
							$templates_status .= '<option>' . $tempname . ' (' . $times . ')</option>' . "\n";
						}
					}
				}
				$templates_status .= '</optgroup>' . "\n";
				$templates_status .= '</select>';
			}
		}
		$ms_output .= '<tr align="' . $stylevar['right'] . '">' . "\n";
		$ms_output .= '	<td class="alt1"' . iif($show['quickchooser'] OR $show['languagechooser'], ' colspan="' . $colspan . '"') . '>' . "\n";
		$ms_output .= '		<span class="smallfont">' . $memory_status . $debug_status . $gzip_status . $server_status . $templates_status . '</span>' . "\n";
		$ms_output .= '	</td>' . "\n";
		$ms_output .= '</tr>' . "\n";
	}

	$output = str_replace('{microstats}', $ms_output, $output);
}

ok now when i remove the bottom table it all groups in one line... im tryin to keep it 2 lines like you have it but when i remove the admins alt1
Code:
	$ms_output .= '	<td class="alt1"' . iif($show['quickchooser'] OR $show['languagechooser'], ' colspan="' . $colspan . '"') . '>' . "\n";
thats when it all groups where should i add a break?
Reply With Quote
  #30  
Old 05-19-2006, 05:12 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TECK
Bob, I looked at your site, it looks fine?
If you want to place the microstats after the vBulletin copyright (for example), use my second $ms_output template, listed above.
Here's what I see.

EDIT: Ok, I now see what you mean. Am working on it now. Thank you, sir.
Reply With Quote
  #31  
Old 05-19-2006, 05:14 AM
DementedMindz DementedMindz is offline
 
Join Date: Jan 2006
Posts: 1,474
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

here is my screen shot so far of what i have going on... just tryin to figure out the admin table now
Reply With Quote
Reply


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 01:54 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.04664 seconds
  • Memory Usage 2,324KB
  • 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
  • (6)bbcode_code
  • (3)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