Admun's NUDN

admun

  • San Francisco, CA

Navigation

Navigation

Categories

More Benchmarking Nucleus

Building on top of existing benchmarking infrastructure, here I show how to count number of SQL queries a page generated.

  1. Add SQL query counter in benchmark_setup.txt
  2. global $SQLQCount;
    $SQLQCount = 0;
    
  3. 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;
    }
    
  4. Show the Count at the end after the page is processed (from benchmark.txt)
  5.   global $SQLCount;
      printf("%d SQL queries recorded<br />", $SQLCount);
    
    
Note, there are some limitation with this method; The total query count does not register those query by mysql_query directly. Actually, many plugins do this.... which need to be fixed. Also, the queries done by Nucleus is not take into account.

20:09:33 on 10/13/04 by Admun - Category: Developer Notes - tags: none - print

Comments

hcgtv wrote:

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...

10/13/04 23:46:47

Admun wrote:

yes... it missing a "/"///

10/14/04 09:06:13

Add Comments



<=   November 2009   =>
SunMonTueWedThuFriSat
1234567
891011121314
15161718192021
22232425262728
2930     

My Quick Links

Documentation

How-To & Tips

Source Code

Developers utc

Latest Comments

  • Admun says If you are running wp from a hosting environment, your system admin people can tell...
  • Dan says Hi, Im a noob and Im not sure what to input for the Database Name, for Nucleus and...
  • Admun says what version of PHP you are running? It looks like this function is...
  • Kevin says I am getting this error: Fatal error: Call to undefined function sql_table() in...
  • Admun says thx Frank, I will look into it.
  • ftruscot says admun, a bug/fix suggestion on the forum that you might want to look at:...
  • Admun says Indeed David. 8( A quick fix for now until 0.9 is out: - do a "ALTER TABLE...
  • David Geens says Dear Edmond, Your twitter plugin suffer from the twitocalyps. You should...

Most Downloads