[mapserver-commits] r7769 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Jul 2 10:25:46 EDT 2008


Author: dmorissette
Date: 2008-07-02 10:25:45 -0400 (Wed, 02 Jul 2008)
New Revision: 7769

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapserv.c
   trunk/mapserver/maputil.c
Log:
 Added more debug/tuning output to mapserv at debug level 2 (#2673)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-07-02 13:16:13 UTC (rev 7768)
+++ trunk/mapserver/HISTORY.TXT	2008-07-02 14:25:45 UTC (rev 7769)
@@ -12,6 +12,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Added more debug/tuning output to mapserv at debug level 2 (#2673)
+
 - maptemplate.c: removed extra line feeds from mime header output. (#2672)
 
 - mapresample.c: fix for bug 2540 when using raster resampling and AGG.

Modified: trunk/mapserver/mapserv.c
===================================================================
--- trunk/mapserver/mapserv.c	2008-07-02 13:16:13 UTC (rev 7768)
+++ trunk/mapserver/mapserv.c	2008-07-02 14:25:45 UTC (rev 7769)
@@ -33,6 +33,7 @@
 #endif
 
 #include "mapserv.h"
+#include "maptime.h"
 
 #ifndef WIN32
 #include <signal.h>
@@ -184,7 +185,7 @@
   int i,j,k;
   mapObj *map = NULL;
   char *tmpstr, *key, *value=NULL;
-  
+
   for(i=0;i<mapserv->request->NumParams;i++) /* find the mapfile parameter first */
     if(strcasecmp(mapserv->request->ParamNames[i], "map") == 0) break;
   
@@ -269,7 +270,7 @@
       }
     }
   } 
-        
+
   return map;
 }
 
@@ -1113,8 +1114,9 @@
   char buffer[1024], *value=NULL;
   imageObj *img=NULL;
   int status;
-
   int sendheaders = MS_TRUE;
+  struct mstimeval execstarttime, execendtime;
+  struct mstimeval requeststarttime, requestendtime;
 
   /* Use MS_ERRORFILE and MS_DEBUGLEVEL env vars if set */
   if( msDebugInitFromEnv() != MS_SUCCESS ) {
@@ -1123,6 +1125,9 @@
     exit(0);
   }
 
+  if(msGetGlobalDebugLevel() >= MS_DEBUGLEVEL_TUNING) 
+      msGettimeofday(&execstarttime, NULL);
+
   /* -------------------------------------------------------------------- */
   /*      Process arguments.  In normal use as a cgi-bin there are no     */
   /*      commandline switches, but we provide a few for test/debug       */
@@ -1208,6 +1213,9 @@
 
     mapserv->map = loadMap();
 
+    if( mapserv->map->debug >= MS_DEBUGLEVEL_TUNING) 
+      msGettimeofday(&requeststarttime, NULL);
+
 #ifdef USE_FASTCGI
     if( mapserv->map->debug ) {
       static int nRequestCounter = 1;
@@ -1265,6 +1273,12 @@
       ** At this point any error has already been handled
       ** as an XML exception by the OGC service.
       */
+      if(mapserv->map->debug >= MS_DEBUGLEVEL_TUNING) {
+        msGettimeofday(&requestendtime, NULL);
+        msDebug("mapserv request processing time (msLoadMap not incl.): %.3fs\n", 
+                (requestendtime.tv_sec+requestendtime.tv_usec/1.0e6)-
+                (requeststarttime.tv_sec+requeststarttime.tv_usec/1.0e6) );
+      }
       msFreeMapServObj(mapserv);
       
 #ifdef USE_FASTCGI
@@ -1272,6 +1286,12 @@
       continue;
 #else
       /* normal case, processing is complete */
+      if(msGetGlobalDebugLevel() >= MS_DEBUGLEVEL_TUNING) {
+        msGettimeofday(&execendtime, NULL);
+        msDebug("mapserv total execution time: %.3fs\n", 
+                (execendtime.tv_sec+execendtime.tv_usec/1.0e6)-
+                (execstarttime.tv_sec+execstarttime.tv_usec/1.0e6) );
+      }
       msCleanup();
       exit( 0 );
 #endif
@@ -1804,6 +1824,13 @@
     if(SelectLayer) free(SelectLayer);
     if(QueryFile) free(QueryFile);
 
+    if(mapserv->map->debug >= MS_DEBUGLEVEL_TUNING) {
+      msGettimeofday(&requestendtime, NULL);
+      msDebug("mapserv request processing time (loadmap not incl.): %.3fs\n", 
+              (requestendtime.tv_sec+requestendtime.tv_usec/1.0e6)-
+              (requeststarttime.tv_sec+requeststarttime.tv_usec/1.0e6) );
+    }
+
     msFreeMapServObj(mapserv);
 
 #ifdef USE_FASTCGI
@@ -1811,6 +1838,13 @@
   }
 #endif
 
+  if(msGetGlobalDebugLevel() >= MS_DEBUGLEVEL_TUNING) {
+    msGettimeofday(&execendtime, NULL);
+    msDebug("mapserv total execution time: %.3fs\n", 
+            (execendtime.tv_sec+execendtime.tv_usec/1.0e6)-
+            (execstarttime.tv_sec+execstarttime.tv_usec/1.0e6) );
+  }
+
   msCleanup();
 
   exit(0); /* end MapServer */

Modified: trunk/mapserver/maputil.c
===================================================================
--- trunk/mapserver/maputil.c	2008-07-02 13:16:13 UTC (rev 7768)
+++ trunk/mapserver/maputil.c	2008-07-02 14:25:45 UTC (rev 7769)
@@ -31,6 +31,7 @@
 #include <time.h>
 
 #include "mapserver.h"
+#include "maptime.h"
 #include "mapparser.h"
 #include "mapthread.h"
 #include "mapfile.h"
@@ -637,7 +638,10 @@
 {
     int nReturnVal = -1;
     char szPath[MS_MAXPATHLEN];
+    struct mstimeval starttime, endtime;
 
+    if(map->debug >= MS_DEBUGLEVEL_TUNING) msGettimeofday(&starttime, NULL);
+
     if (img)
     {
         if( MS_DRIVER_GD(img->format) )
@@ -713,6 +717,13 @@
                        "msSaveImage()"); 
     }
 
+    if(map->debug >= MS_DEBUGLEVEL_TUNING) {
+      msGettimeofday(&endtime, NULL);
+      msDebug("msSaveImage() total time: %.3fs\n", 
+              (endtime.tv_sec+endtime.tv_usec/1.0e6)-
+              (starttime.tv_sec+starttime.tv_usec/1.0e6) );
+    }
+
     return nReturnVal;
 }
 



More information about the mapserver-commits mailing list