]> granicus.if.org Git - postgis/commitdiff
Added 'label' argument to the profreport macro.
authorSandro Santilli <strk@keybit.net>
Wed, 22 Sep 2004 13:45:11 +0000 (13:45 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 22 Sep 2004 13:45:11 +0000 (13:45 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@873 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_functions_basic.c
lwgeom/lwgeom_geos.c
lwgeom/profile.h

index 033fce1495f5fbc7e16ec8a209cf6d443f5d8282..bd11d8fa6a12b97b26be23b14875e8878ffb9d00 100644 (file)
@@ -1956,7 +1956,10 @@ Datum LWGEOM_mindistance2d(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       //proftime[PROF_G2P] = 0;
+       //proftime[PROF_P2G] = 0;
+       //proftime[PROF_GRUN] = 0;
+       profreport("dist",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_FLOAT8(mindist);
index 4af93d21708e618427f8ebba52b8516c6acae9ea..e4a6293c57f7b5d7f2d7dbb4413a7dd02d924736 100644 (file)
@@ -303,7 +303,7 @@ Datum geomunion(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, result);
+       profreport("geos",geom1, geom2, result);
 #endif
 
        PG_RETURN_POINTER(result);
@@ -385,7 +385,7 @@ Datum symdifference(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, result);
+       profreport("geos",geom1, geom2, result);
 #endif
 
        PG_RETURN_POINTER(result);
@@ -458,7 +458,7 @@ Datum boundary(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, NULL, result);
+       profreport("geos",geom1, NULL, result);
 #endif
 
        PG_RETURN_POINTER(result);
@@ -521,7 +521,7 @@ Datum convexhull(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, NULL, result);
+       profreport("geos",geom1, NULL, result);
 #endif
 
        PG_RETURN_POINTER(result);
@@ -593,7 +593,7 @@ Datum buffer(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, NULL, result);
+       profreport("geos",geom1, NULL, result);
 #endif
 
        PG_RETURN_POINTER(result);
@@ -693,7 +693,7 @@ Datum intersection(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, result);
+       profreport("geos",geom1, geom2, result);
 #endif
 
        PG_RETURN_POINTER(result);
@@ -772,7 +772,7 @@ Datum difference(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, result);
+       profreport("geos",geom1, geom2, result);
 #endif
 
        PG_RETURN_POINTER(result);
@@ -843,7 +843,7 @@ Datum pointonsurface(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, NULL, result);
+       profreport("geos",geom1, NULL, result);
 #endif
 
        PG_RETURN_POINTER(result);
@@ -905,7 +905,7 @@ Datum centroid(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom, NULL, result);
+       profreport("geos",geom, NULL, result);
 #endif
 
        PG_RETURN_POINTER(result);
@@ -967,7 +967,7 @@ Datum isvalid(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, NULL, NULL);
+       profreport("geos",geom1, NULL, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1038,7 +1038,7 @@ Datum overlaps(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       profreport("geos",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1108,7 +1108,7 @@ Datum contains(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       profreport("geos",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1177,7 +1177,7 @@ Datum within(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       profreport("geos",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1247,7 +1247,7 @@ Datum crosses(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       profreport("geos",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1315,7 +1315,7 @@ Datum intersects(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       profreport("intr",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1384,7 +1384,7 @@ Datum touches(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       profreport("geos",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1452,7 +1452,7 @@ Datum disjoint(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       profreport("geos",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1510,7 +1510,7 @@ Datum relate_pattern(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       profreport("geos",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1598,7 +1598,7 @@ Datum relate_full(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       profreport("geos",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_POINTER(result);
@@ -1667,7 +1667,7 @@ Datum geomequals(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom1, geom2, NULL);
+       profreport("geos",geom1, geom2, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1718,7 +1718,7 @@ Datum issimple(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom, NULL, NULL);
+       profreport("geos",geom, NULL, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
@@ -1774,7 +1774,7 @@ Datum isring(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       profreport(geom, NULL, NULL);
+       profreport("geos",geom, NULL, NULL);
 #endif
 
        PG_RETURN_BOOL(result);
index 815af7d6e779d9843fc7bae67870cedaa7b3cab9..fcbf54896d984d4914acb3a2697fba503077e27d 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _PROFILE_H
 #define _PROFILE_H 1
 
+#include <math.h>
+
 /*
  * Define this to have profiling enabled
  */
@@ -20,7 +22,7 @@ long profipts, profopts;
        proftime[x] = ( profstop[x].tv_sec*1000000+profstop[x].tv_usec) - \
                ( profstart[x].tv_sec*1000000+profstart[x].tv_usec); \
        } while (0);
-#define profreport(x, y, r) do { \
+#define profreport(n, x, y, r) do { \
        profipts = 0; \
        if ((x)) profipts += lwgeom_npoints(SERIALIZED_FORM((x))); \
        if ((y)) profipts += lwgeom_npoints(SERIALIZED_FORM((y))); \
@@ -33,13 +35,15 @@ long profipts, profopts;
        int convpercent = round(((double)conv/(double)tot)*100); \
        int runpercent = round(((double)run/(double)tot)*100); \
        elog(NOTICE, \
-               "PROF_DET: npts:%lu+%lu=%lu cnv:%lu+%lu run:%lu gtot:%lu qtot:%lu", \
+               "PROF_DET(%s): npts:%lu+%lu=%lu cnv:%lu+%lu run:%lu gtot:%lu qtot:%lu", \
+               (n), \
                profipts, profopts, profipts+profopts, \
                proftime[PROF_P2G], proftime[PROF_G2P], \
                proftime[PROF_GRUN], \
                proftime[PROF_P2G]+proftime[PROF_G2P]+proftime[PROF_GRUN], \
                proftime[PROF_QRUN]); \
-       elog(NOTICE, "PROF_SUM: pts %lu cnv %d%% grun %d%% tot %d%%", \
+       elog(NOTICE, "PROF_SUM(%s): pts %lu cnv %d%% grun %d%% tot %d%%", \
+               (n), \
                profipts+profopts, \
                convpercent, \
                runpercent, \