From 71164db850092a0d7784c27834921c61b52b7d0f Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 22 Sep 2004 13:45:11 +0000 Subject: [PATCH] Added 'label' argument to the profreport macro. git-svn-id: http://svn.osgeo.org/postgis/trunk@873 b70326c6-7e19-0410-871a-916f4a2858ee --- lwgeom/lwgeom_functions_basic.c | 5 +++- lwgeom/lwgeom_geos.c | 44 ++++++++++++++++----------------- lwgeom/profile.h | 10 +++++--- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/lwgeom/lwgeom_functions_basic.c b/lwgeom/lwgeom_functions_basic.c index 033fce149..bd11d8fa6 100644 --- a/lwgeom/lwgeom_functions_basic.c +++ b/lwgeom/lwgeom_functions_basic.c @@ -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); diff --git a/lwgeom/lwgeom_geos.c b/lwgeom/lwgeom_geos.c index 4af93d217..e4a6293c5 100644 --- a/lwgeom/lwgeom_geos.c +++ b/lwgeom/lwgeom_geos.c @@ -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); diff --git a/lwgeom/profile.h b/lwgeom/profile.h index 815af7d6e..fcbf54896 100644 --- a/lwgeom/profile.h +++ b/lwgeom/profile.h @@ -1,6 +1,8 @@ #ifndef _PROFILE_H #define _PROFILE_H 1 +#include + /* * 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, \ -- 2.40.0