Added performance measurement.
authorarjen <arjen>
Thu, 14 Aug 2003 10:33:01 +0000 (10:33 +0000)
committerarjen <arjen>
Thu, 14 Aug 2003 10:33:01 +0000 (10:33 +0000)
src/web/parameter.php

index d612b4d..968a656 100644 (file)
@@ -9,7 +9,7 @@
 ***********************
 **      FILE NAME      : parameter.php
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.5 $
+**      VERSION NUMBER : $Revision: 1.6 $
 **
 **  DESCRIPTION      : 
 **
 ********************************
 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
 **      CREATION DATE   : Dec 04, 2002
-**      LAST UPDATE     : Feb 08, 2003
+**      LAST UPDATE     : Aug 04, 2003
 **      MODIFICATIONS   : 
 **************************************************************************/
 
 /*****************************
    $Log: parameter.php,v $
-   Revision 1.5  2003-07-15 11:06:45  arjen
+   Revision 1.6  2003-08-14 10:33:01  arjen
+   Added performance measurement.
+
+   Revision 1.5  2003/07/15 11:06:45  arjen
    Removed parameters are displayed in a shaded style.
 
    Revision 1.4  2003/02/21 08:50:12  arjen
@@ -41,7 +44,7 @@
 
 ******************************/
 
-// RCSID = "$Id: parameter.php,v 1.5 2003-07-15 11:06:45 arjen Exp $";
+// RCSID = "$Id: parameter.php,v 1.6 2003-08-14 10:33:01 arjen Exp $";
 
 
 ini_set('include_path', '.:./classes:../phpclasses');
@@ -51,11 +54,18 @@ require_once('page.class.php');
 
 /*  Local functions */
 
+function getmicrotime()
+{
+   list ($usec, $sec) = explode(" ", microtime());
+   return (float)$sec + (float)$usec;
+}
+
 function object_selection($db, $skip_oid)
 {
    /*  Create and print an HTML option list of objects */
 
-   $res = pg_exec("SELECT objectid, objectname FROM object WHERE objectid != " . $skip_oid);
+   $res = pg_exec("SELECT objectid, objectname FROM object WHERE objectid != "
+                     . $skip_oid . "ORDER BY objectname");
    for ($row = 0; $row < pg_numrows($res); $row++)
    {
       $obj = pg_fetch_object($res, $row);
@@ -94,6 +104,7 @@ class param_page extends page
       echo "<hr>";
       echo "<table>";
       $row = 0;
+      $start_time = getmicrotime();
       while ($row < pg_numrows($res))
       {
          $par = pg_fetch_object($res, $row);
@@ -126,6 +137,10 @@ class param_page extends page
          $row++;
       }
       echo "</table>";
+      $duration = getmicrotime() - $start_time;
+
+      echo "$row parameters in " . round($duration, 3) . " seconds (";
+      echo round($duration / $row * 1000, 3) . " milliseconds per parameter).<br>";
    }
    }
 }