vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Microstats (only for admin) - load times, server loads, queries, uncached templates! (https://vborg.vbsupport.ru/showthread.php?t=59700)

Erwin 04-21-2004 10:03 AM

Quote:

Originally Posted by kmike
Perfect hack.
I just want to suggest a little tweak which will eliminate exec call (and associated "fork" system call). It will work at least on Linux, not sure about freebsd.
PHP Code:

        if ($bbuserinfo[usergroupid]==6) {
                
$pageendtime microtime();
                
$starttime explode(' '$pagestarttime);
                
$endtime explode(' '$pageendtime);
                
$totaltime vb_number_format($endtime[0] - $starttime[0] + $endtime[1] - $starttime[1], 5);
                
$loadavg = @file_get_contents("/proc/loadavg");
                if (
$loadavg) {
                        
$regs explode(" ",$loadavg);
                        
$serverload=' [Server Loads: <b>'.$regs[0].'</b> '.$regs[1].' : '.$regs[2].']';
                }
                
$debughtml "<center><span class=\"smallfont\">Page generated in <b>$totaltime</b> seconds with <b>$query_count</b> queries" iif($_TEMPLATEQUERIES" (<b>" sizeof($_TEMPLATEQUERIES) . "</b> queries for uncached templates)"'') . "$serverload</span></center>";
                
$vartext str_replace('</body>'"$debughtml\n</body>"$vartext);
        } 


Great idea!!! :)

I've updated the first post. People feel free to update to the code in the 1st post. It should lessen the load slightly.

buro9 04-21-2004 10:23 AM

Thanks for the update... appreciated that you keep us up to date with improvements :)

Nice tweak, and updated in no time :)

d3nnis 04-21-2004 10:46 AM

Quote:

Originally Posted by iguanairs
I have 2 uncached templates. I don't know how to cache a template. That is something I haven't done yet. I could use some guidance with this.


yah i would like to learn too!

d3nnis 04-21-2004 01:25 PM

i followed this codes :

Code:

// Microstats hack
if ($bbuserinfo[usergroupid]==6) {
                $pageendtime = microtime();
                $starttime = explode(' ', $pagestarttime);
                $endtime = explode(' ', $pageendtime);
                $totaltime = vb_number_format($endtime[0] - $starttime[0] + $endtime[1] - $starttime[1], 5);
                $loadavg = @file_get_contents("/proc/loadavg");
                if ($loadavg) {
                        $regs = explode(" ",$loadavg);
                        $serverload=' [Server Loads: <b>'.$regs[0].'</b> '.$regs[1].' : '.$regs[2].']';
                }
                $debughtml = "<center><span class=\"smallfont\">Page generated in <b>$totaltime</b> seconds with <b>$query_count</b> queries" . iif($_TEMPLATEQUERIES, " (<b>" . sizeof($_TEMPLATEQUERIES) . "</b> queries for uncached templates)", '') . "$serverload</span></center>";
                $vartext = str_replace('</body>', "$debughtml\n</body>", $vartext);

}
//Microstats Hack

but it does not shows the server load except number of queries executed in xxx secs anymore.

Rich 04-21-2004 01:34 PM

Quote:
Originally Posted by iguanairs
I have 2 uncached templates. I don't know how to cache a template. That is something I haven't done yet. I could use some guidance with this.

yah i would like to learn too!

Just bumping as there are now 2 of us trying to figure this out. How do we cache a page?

Rich 04-21-2004 06:48 PM

Bump

I know this is easy to do. Can I query it? I searched these forums and when you type in cache template,etc you get hundreds of listings,but not telling how! Please answer this. I know 90% of you know how to do it.

kmike 04-21-2004 07:02 PM

d3nnis:
Did server load show before? What's your server OS?

d3nnis 04-22-2004 12:22 AM

Quote:

Originally Posted by kmike
d3nnis:
Did server load show before? What's your server OS?

yup before i change to the new codes... the server load does show.

using redhat 7.3 :nervous:

JaNa 04-22-2004 12:41 AM

Hm! Very simple, and looks pertty good. I'll probaly use this....(Clicks Install)

Erwin 04-22-2004 03:00 AM

Quote:

Originally Posted by iguanairs
Quote:
Originally Posted by iguanairs
I have 2 uncached templates. I don't know how to cache a template. That is something I haven't done yet. I could use some guidance with this.



yah i would like to learn too!

Just bumping as there are now 2 of us trying to figure this out. How do we cache a page?

To cache a template, you need to find out which ones are not being cached. Then you add it to the top of the PHP file being run, in the section where it lists templates to be cached.

I may add a feature to this hack so that uncached templates show up with names.


All times are GMT. The time now is 01:00 AM.

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.01286 seconds
  • Memory Usage 1,758KB
  • 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
  • (1)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)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