]> granicus.if.org Git - postgis/commitdiff
Profile output modified again, input geoms points and conversion times separated
authorSandro Santilli <strk@keybit.net>
Thu, 23 Sep 2004 10:13:15 +0000 (10:13 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 23 Sep 2004 10:13:15 +0000 (10:13 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@886 b70326c6-7e19-0410-871a-916f4a2858ee

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

index 54f2330c449af2b28f35dacb63ddbd403be631c0..cc836fd1895b9305f50430b9978f5374d9a849a1 100644 (file)
@@ -1956,9 +1956,6 @@ Datum LWGEOM_mindistance2d(PG_FUNCTION_ARGS)
 
 #ifdef PROFILE
        profstop(PROF_QRUN);
-       //proftime[PROF_G2P] = 0;
-       //proftime[PROF_P2G] = 0;
-       //proftime[PROF_GRUN] = 0;
        profreport("dist",geom1, geom2, NULL);
 #endif
 
index e4a6293c57f7b5d7f2d7dbb4413a7dd02d924736..70fd7b4ddf7d0502e2edb5781c31e50b1bab3f83 100644 (file)
@@ -248,12 +248,18 @@ Datum geomunion(PG_FUNCTION_ARGS)
 //elog(NOTICE,"in geomunion");
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 //elog(NOTICE,"g1=%s",GEOSasText(g1));
@@ -333,12 +339,18 @@ Datum symdifference(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 #ifdef PROFILE
@@ -408,11 +420,11 @@ Datum boundary(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1 );
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G1);
 #endif
 
 #ifdef PROFILE
@@ -437,7 +449,7 @@ Datum boundary(PG_FUNCTION_ARGS)
 #endif
        result = GEOS2POSTGIS(g3, lwgeom_ndims(geom1->type) > 2);
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
 
        if (result == NULL)
@@ -480,11 +492,11 @@ Datum convexhull(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1 );
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G1);
 #endif
 
 #ifdef PROFILE
@@ -546,11 +558,11 @@ Datum buffer(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1 );
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G1);
 #endif
 
 #ifdef PROFILE
@@ -623,12 +635,18 @@ Datum intersection(PG_FUNCTION_ARGS)
 //elog(NOTICE,"intersection() START");
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 //elog(NOTICE,"               constructed geometrys - calling geos");
@@ -722,12 +740,18 @@ Datum difference(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 #ifdef PROFILE
@@ -796,11 +820,11 @@ Datum pointonsurface(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G1);
 #endif
 
 #ifdef PROFILE
@@ -864,11 +888,11 @@ Datum centroid(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        geosgeom = POSTGIS2GEOS(geom);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G1);
 #endif
 
 #ifdef PROFILE
@@ -942,11 +966,11 @@ Datum isvalid(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G1);
 #endif
 
 #ifdef PROFILE
@@ -1012,12 +1036,18 @@ Datum overlaps(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 #ifdef PROFILE
@@ -1081,12 +1111,18 @@ Datum contains(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 #ifdef PROFILE
@@ -1150,12 +1186,18 @@ Datum within(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 #ifdef PROFILE
@@ -1220,12 +1262,18 @@ Datum crosses(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 #ifdef PROFILE
@@ -1290,12 +1338,18 @@ Datum intersects(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1 );
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2 );
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 #ifdef PROFILE
@@ -1357,12 +1411,18 @@ Datum touches(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1 );
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2 );
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 #ifdef PROFILE
@@ -1426,12 +1486,18 @@ Datum disjoint(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 #ifdef PROFILE
@@ -1480,12 +1546,18 @@ Datum relate_pattern(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
        patt =  DatumGetCString(DirectFunctionCall1(textout,
@@ -1545,12 +1617,18 @@ Datum relate_full(PG_FUNCTION_ARGS)
 //elog(NOTICE,"GEOS init()");
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1 );
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2 );
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 //elog(NOTICE,"constructed geometries ");
@@ -1641,12 +1719,18 @@ Datum geomequals(PG_FUNCTION_ARGS)
        initGEOS(MAXIMUM_ALIGNOF);
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom1);
+#ifdef PROFILE
+       profstop(PROF_P2G1);
+#endif
+#ifdef PROFILE
+       profstart(PROF_P2G2);
+#endif
        g2 = POSTGIS2GEOS(geom2);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G2);
 #endif
 
 #ifdef PROFILE
@@ -1694,11 +1778,11 @@ Datum issimple(PG_FUNCTION_ARGS)
        //elog(NOTICE,"GEOS init()");
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom);
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G1);
 #endif
 
 #ifdef PROFILE
@@ -1750,11 +1834,11 @@ Datum isring(PG_FUNCTION_ARGS)
        //elog(NOTICE,"GEOS init()");
 
 #ifdef PROFILE
-       profstart(PROF_P2G);
+       profstart(PROF_P2G1);
 #endif
        g1 = POSTGIS2GEOS(geom );
 #ifdef PROFILE
-       profstop(PROF_P2G);
+       profstop(PROF_P2G1);
 #endif
 
 #ifdef PROFILE
index fcbf54896d984d4914acb3a2697fba503077e27d..b7176b3b9b80ff4fee63fc97cf83f27ea0766971 100644 (file)
 
 #ifdef PROFILE
 #include <sys/time.h>
-#define PROF_P2G 0
-#define PROF_G2P 1
-#define PROF_GRUN 2
-#define PROF_QRUN 3
-struct timeval profstart[4], profstop[4];
-long proftime[4];
-long profipts, profopts;
+#define PROF_P2G1 0
+#define PROF_P2G2 1
+#define PROF_G2P 2
+#define PROF_GRUN 3
+#define PROF_QRUN 4
+struct timeval profstart[5], profstop[5];
+long proftime[5];
+long profipts1, profipts2, profopts;
 #define profstart(x) do { gettimeofday(&(profstart[x]), NULL); } while (0);
 #define profstop(x) do { gettimeofday(&(profstop[x]), NULL); \
        proftime[x] = ( profstop[x].tv_sec*1000000+profstop[x].tv_usec) - \
                ( profstart[x].tv_sec*1000000+profstart[x].tv_usec); \
        } while (0);
-#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))); \
-       if ((r)) profopts = lwgeom_npoints(SERIALIZED_FORM((r))); \
-       else profopts = 0; \
-       long int conv = proftime[PROF_P2G]+proftime[PROF_G2P]; \
+#define profreport(n, i1, i2, o) do { \
+       profipts1 = profipts2 = profopts = 0; \
+       if ((i1)) profipts1 += lwgeom_npoints(SERIALIZED_FORM((i1))); \
+       else proftime[PROF_P2G1] = 0; \
+       if ((i2)) profipts2 += lwgeom_npoints(SERIALIZED_FORM((i2))); \
+       else proftime[PROF_P2G2] = 0; \
+       if ((o)) profopts += lwgeom_npoints(SERIALIZED_FORM((o))); \
+       else proftime[PROF_G2P] = 0; \
+       long int conv = proftime[PROF_P2G1]+proftime[PROF_P2G2]+proftime[PROF_G2P]; \
        long int run = proftime[PROF_GRUN]; \
        long int qrun = proftime[PROF_QRUN]; \
        long int tot = qrun; \
        int convpercent = round(((double)conv/(double)tot)*100); \
        int runpercent = round(((double)run/(double)tot)*100); \
        elog(NOTICE, \
-               "PROF_DET(%s): npts:%lu+%lu=%lu cnv:%lu+%lu run:%lu gtot:%lu qtot:%lu", \
+               "PRF(%s) ipt1 %lu ipt2 %lu opt %lu p2g1 %lu p2g2 %lu g2p %lu grun %lu qrun %lu perc %d%%", \
                (n), \
-               profipts, profopts, profipts+profopts, \
-               proftime[PROF_P2G], proftime[PROF_G2P], \
+               profipts1, profipts2, profopts, \
+               proftime[PROF_P2G1], proftime[PROF_P2G2], \
+               proftime[PROF_G2P], \
                proftime[PROF_GRUN], \
-               proftime[PROF_P2G]+proftime[PROF_G2P]+proftime[PROF_GRUN], \
-               proftime[PROF_QRUN]); \
-       elog(NOTICE, "PROF_SUM(%s): pts %lu cnv %d%% grun %d%% tot %d%%", \
-               (n), \
-               profipts+profopts, \
-               convpercent, \
-               runpercent, \
-               convpercent+runpercent); \
+               proftime[PROF_QRUN], \
+               runpercent+convpercent); \
        } while (0);
 #endif // PROFILE