Injader

How to display the query time box

The query time box is used to report how long each process takes to execute within Injader. This may be useful for debugging purposes if you are experiencing performance issues.

Adding the query time box to Injader 2.1.0 - 2.2.0

Skip this section if you are using Injader 2.2.1 or greater.

The code for displaying the query time on your site will only work if you are running Injader 2.2.1 or greater. The query time should still show up in the Control Panel regardless of the version you're running.

If you're not using Injader 2.2.1 yet, you can try adding the new code to sys/includes/html/Theme.php. You are strongly recommended to take a backup of Theme.php before you make the change.

Here's the code you need to add.

  function GetSysQueryTime() {
    global $strExecutionTime; // Set in header.php
    if ($strExecutionTime) {
      $strQueryTimeData = <<<ExecTime
<div id="majQueryTimeData">
<p>Query Execution Time</p>
<ul>
$strExecutionTime
</ul>
</div>
ExecTime;
    } else {
      $strQueryTimeData = "";
    }
    return $strQueryTimeData;
  }

The indenting, or lack thereof, is critical in order to make this code work correctly. The code ExecTime; must not have any spacing at the start of end of the line, or it won't work.

After making the change, save Theme.php and follow the rest of this guide.

How to implement

Start by editing sys/header.php. Near to the top, you'll see the following code:

/*
  ***** Test Mode *****
  Q_ALL   - Display Query Execution Time box
  Q_DB    - Only display database queries
  <empty> - Don't display the box
*/
define('C_TEST_MODE', "");

The default install will not have the query time box enabled by default. You have to turn it on. To do this, type either Q_ALL or Q_DB between the double quotes. Q_ALL may be useful for extensive debugging, but if any issues exist, they are most likely to be database related. Try using Q_DB for starters.

The next section of header.php looks like this:

/*
  ***** Test Threshold *****
  4 - Display queries that reach L4
  3 - Display queries that reach L3, L4
  2 - Display queries that reach L2, L3, L4
  1 - Display queries that reach L1, L2, L3, L4
  0 - Display all queries
*/
$intMaxLevel = 0;

If you only want to display the most resource-intenstive queries, change $intMaxLevel = 0 to a different value. This may be useful if you're using Q_ALL.

Save header.php. Now open footer.php in your theme. At the very end, you should see some code that looks like this:

<?php print($CMS->TH->GetSysWrapperEnd()); ?>
</body>
</html>

It's possible your theme may be different, but all themes should end with </body></html>. Add the following code before the </body> tag:

<?php print($CMS->TH->GetSysQueryTime()); ?>

Now save the changes and go to your site. The query time box should appear at the bottom of every page, and at the bottom of the Control Panel.

Navigation: start

 
how_to_display_the_query_time_box.txt · Last modified: 2009/03/27 05:28 by admin