Added 'label' argument to the profreport macro.

git-svn-id: http://svn.osgeo.org/postgis/trunk@873 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2004-09-22 13:45:11 +00:00
parent 0f687e9f3f
commit 71164db850
3 changed files with 33 additions and 26 deletions

View 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);

View 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);

View 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, \