The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Microstats - load times, server loads, queries, uncached templates Details »» | |||||||||||||||||||||||||||
Microstats - load times, server loads, queries, uncached templates
Developer Last Online: Nov 2023
This is a derivative of Erwin's microstats hack for vBulletin 3.5.0's plugin system. The main difference is that by default it shows the page generation time and query count to the public. Server loads and Uncached Queries are shown only to administrators.
I had sent this to Erwin so he could release if he wanted to but instead he told me that I had permission to release it; hence why I am releasing it. This should work with vBulletin 3.5.0 RC 1 through vBulletin 3.6.1 and later. Installation is very simple. Just import the plugin via vBulletin's "Download / Upload Plugins" page in the Plugin System in the Admin Control Panel and you're done. I'll try to correct any bugs that you find. Let me know if you like this plugin and don't forget to click the install link if you install this. Optional config.php Variables $config['Microstats']['replacementvariable'] Setting this variable will make microstats place its data before any instance of whatever you set this variable to. Be careful with this as you might see microstats in mutiple places. My suggestion is to use a unique comment in the HTML source to prevent any issues. E.g. $config['Microstats']['replacementvariable'] = '<!-- display microstats here -->'; $config['Microstats']['adminonly'] Setting this variable to anything will make microstats display itself only to administrators. E.g. $config['Microstats']['adminonly'] = true; Update History Product File: Uploaded a product file that replaced the plugin file. Version 1.2.1: Fixed a bug that broke optional config.php settings Version 1.2.0: Added OpenBSD, FreeBSD and NetBSD support; added Replacement variable setting in config.php; added Display only to Administrators Setting in config.php; fixed bug affecting Linux/Unix servers that have exec('uptime') support and not /proc/loadavg support Version 1.1.0: Added names of uncached templates, included a bugfix for people who don't have proc avaliable on their system and made the code look a little nicer as well Version 1.0.1: Bugfix for Windows users, sanitized the code to make it look nicer Version 1.0.0: Initial Release Show Your Support
|
Comments |
#352
|
|||
|
|||
Working in 3.7.2, Thanks!
|
#353
|
|||
|
|||
Installed and working on 3.7.2.
|
#354
|
|||
|
|||
How do we enable this option to work for multiple usergroups ?
We want Administrators, super-moderators and moderator usergroups to be able to check server load.s thanks |
#355
|
|||
|
|||
How would I go about moving the location of the text that gets printed out?
I would like to put it with the copyright text... Otherwise it screws with my design: http://www.8wayrun.com/forums.php |
#356
|
||||
|
||||
Worked on 373PL1 :up:
|
#357
|
||||
|
||||
It is possible to see which query is taking how much time to execute? So that we can debug or optimize those queries. i am facing issued when clicking on the Forums to go to forumdisplay.php. Its taking like 25 secs on load 43 queries on a forumdisplay.php page. How can view those queries and how much they are taking. This is most urgent please.
|
#358
|
|||
|
|||
I don't think this hack can be used to time individual queries, it only marks the time difference between the page request and when it is complete.
43 queries on a forumdisplay.php page seems like quite a bit of them. I just loaded the forumdisplay.php page on two forums I admin. The more customized one ran 26 queries on a forumdisplay, one that is a little closer to stock ran 21 queries. To figure out what is taking so long on yours, I'd disable all plug-ins, then re-enable them 1 by 1 until you see the page load time increase dramatically. |
#359
|
|||
|
|||
works with 3.8.0 beta 4 as well
|
#360
|
||||
|
||||
Quote:
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 |
#361
|
||||
|
||||
I need this plugin :
generated this page in 0.21 seconds (79.54% PHP - 20.46% MySQL) with 11 queries. from forum http://forums.offtopic.com/ p.s. good forum... Posts: 112,870,447 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|