vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Microstats - load times, server loads, queries, uncached templates (https://vborg.vbsupport.ru/showthread.php?t=82900)

Xencored 04-06-2009 04:10 AM

i get

Uncached templates: awards_postbit_display (1)
Uncached templates: im_msn (1)
Uncached templates: postbit_legacy (1)
Uncached templates: postbit_onlinestatus (1)
Uncached templates: postbit_reputation (3)
Uncached templates: postbit_wrapper (1)

is this bad? :confused:

Icy 04-06-2009 06:15 AM

Yes it is! You're having 8 extra queries just for these uncached queries!

Xencored 04-06-2009 05:17 PM

Quote:

Originally Posted by Icy (Post 1784857)
Yes it is! You're having 8 extra queries just for these uncached queries!

How can i fix this than mate

Cheers

Icy 04-06-2009 05:30 PM

I guess one of your modification cause this though I'm not sure which one. Try disabling one by one and test :)

Lynne 04-06-2009 05:33 PM

Or read the article in the article section about how to cache your templates.

Icy 04-06-2009 05:54 PM

But Lynne these are the default templates which should be cached by default unless he changed something from the core vBulletin code right?

Lynne 04-06-2009 06:17 PM

Quote:

Originally Posted by Icy (Post 1785205)
But Lynne these are the default templates which should be cached by default unless he changed something from the core vBulletin code right?

You are right. I just looked at the first one (awards_) and knew that was not default. So yes, you are right in guessing some modification is causing the problem.

jw00dy 04-09-2009 12:40 AM

I use this free caching mod from Ziki: https://vborg.vbsupport.ru/showthread.php?p=1784393 Works great on 3.8 and 3.7

ubcforums 05-30-2009 04:14 PM

working on 3.82 as well !!

David_R 08-22-2009 10:49 AM

Quote:

Originally Posted by zefyx (Post 1693465)
Go to Plugin & Products System -> Product Manager -> Microstats.

Remove the current code, replace with..

$pageendtime = microtime();
$starttime = explode(' ', $pagestarttime);
$endtime = explode(' ', $pageendtime);
$totaltime = vb_number_format($endtime[0] - $starttime[0] + $endtime[1] - $starttime[1], 5);
$debughtml = '<center><span class="smallfont">Page generated in <b>' . $totaltime . '</b> seconds with <b>' . $vbulletin->db->querycount . '</b> queries';
$usergroupid = $vbulletin->userinfo['usergroupid'];

if ($usergroupid == 5 || $usergroupid == 6 || $usergroupid == 7) {

if ($loadavg = @file_get_contents("/proc/loadavg")) {

$regs = explode(" ",$loadavg);
$serverload = ' [Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2] . ']';

}elseif ($stats=@exec('uptime')) {

preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
$serverload = ' [Server Loads: <b>' . $regs[1] .'</b> ' . $regs[2] . ' : ' . $regs[3] . ']';

}elseif ($loadavg = @`sysctl vm.loadavg|cut -d" " -f3-5`) {

$regs = explode(" ",$loadavg);
$serverload = ' [Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2] . ']';

}

$debughtml .= iif($_TEMPLATEQUERIES, ' (<b>' . sizeof($_TEMPLATEQUERIES) . '</b> queries for uncached templates)', '') . "$serverload";

ksort($tempusagecache);

foreach ($tempusagecache AS $tempname => $times) {
if ($_TEMPLATEQUERIES["$tempname"]){
$debughtml .= '<center><span class="smallfont">Uncached templates: <font color="red"><b>' . $tempname . '</b></font> (' . $times . ')</span></center>';
}
}

}

$debughtml .= "</span></center>";

if (!$vbulletin->config['Microstats']['replacementvariable']) {

$vbulletin->config['Microstats']['replacementvariable'] = '</body>';

}

if (($vbulletin->config['Microstats']['adminonly'] and $vbulletin->userinfo['usergroupid'] == 5 || $usergroupid == 6 || $usergroupid == 7) or !$vbulletin->config['Microstats']['adminonly']){

$output = str_replace($vbulletin->config['Microstats']['replacementvariable'], $debughtml . $vbulletin->config['Microstats']['replacementvariable'], $output);

}


Where you see the usergroupid = 5, 6 & 7, replace those numbers with whatever your usergroup id's are that you want to see the microstats.

Hope this helps :)

I try to use this code, it works proper for super-admin, admin and moderator groups.
but super-admin and moderators cannot see server loads.
i have also placed this line in my config.php
if (($vbulletin->config['Microstats']['adminonly'] = true ;

this my code in plugin manager for microstats
Code:

// Microstats 1.2.1 Plugin

$pageendtime = microtime();
$starttime = explode(' ', $pagestarttime);
$endtime = explode(' ', $pageendtime);
$totaltime = vb_number_format($endtime[0] - $starttime[0] + $endtime[1] - $starttime[1], 5);
$debughtml = '<center><span class="smallfont">Page generated in <b>' . $totaltime . '</b> seconds with <b>' . $vbulletin->db->querycount . '</b> queries';

if ($vbulletin->userinfo['usergroupid'] == 6) {

        if ($loadavg = @file_get_contents("/proc/loadavg")) {
       
                $regs = explode(" ",$loadavg);
                $serverload = ' [Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2] . ']';
       
        }elseif ($stats=@exec('uptime')) {
       
                preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
                $serverload = ' [Server Loads: <b>' . $regs[1] .'</b> ' . $regs[2] . ' : ' . $regs[3] . ']';
       
        }elseif ($loadavg = @`sysctl vm.loadavg|cut -d" " -f3-5`) {
       
                $regs = explode(" ",$loadavg);
                $serverload = ' [Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2] . ']';
       
        }

        $debughtml .= iif($_TEMPLATEQUERIES, ' (<b>' . sizeof($_TEMPLATEQUERIES) . '</b> queries for uncached templates)', '') . "$serverload";
       
        ksort($tempusagecache);

        foreach ($tempusagecache AS $tempname => $times) {
                if ($_TEMPLATEQUERIES["$tempname"]){
                        $debughtml .= '<center><span class="smallfont">Uncached templates: <font color="red"><b>' . $tempname . '</b></font> (' . $times . ')</span></center>';
                }
    }

}

$debughtml .= "</span></center>";

if (!$vbulletin->config['Microstats']['replacementvariable']) {

        $vbulletin->config['Microstats']['replacementvariable'] = '</body>';

}

if (($vbulletin->config['Microstats']['adminonly'] and $vbulletin->userinfo['usergroupid'] == 5 || $usergroupid == 6) or !$vbulletin->config['Microstats']['adminonly']){

        $output = str_replace($vbulletin->config['Microstats']['replacementvariable'], $debughtml . $vbulletin->config['Microstats']['replacementvariable'], $output);

}

// Microstats 1.2.1 Plugin



All times are GMT. The time now is 12:01 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.03222 seconds
  • Memory Usage 1,757KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete