More Benchmarking Nucleus
Building on top of existing benchmarking infrastructure, here I show how to count number of SQL queries a page generated.
- Add SQL query counter in benchmark_setup.txt
- Inclement the query counter in sql_query() (@nucleus/libs/globalfunctions.php)
function sql_query($query) { global $SQLCount; $SQLCount++; $res = mysql_query($query) or print("mySQL error with query $query: " . mysql_error() . '<p />'); return $res; }
- Show the Count at the end after the page is processed (from benchmark.txt)
global $SQLQCount; $SQLQCount = 0;
global $SQLCount; printf("%d SQL queries recorded<br />", $SQLCount);
Comments
hcgtv wrote:
10/13/04 23:46:47
Admun wrote:
yes... it missing a "/"///
10/14/04 09:06:13
Nice, would love to see this as part of the main core system.
PS. The RSS feed links from the dev site are broken:
http://edmondhui.homeip.net...