[gdal-dev] OGR C API Spy

Even Rouault even.rouault at spatialys.com
Sun Aug 31 12:14:15 PDT 2014


Le dimanche 31 août 2014 20:50:41, Robert Coup a écrit :
> That's cool :) Is there any particular performance penalty to compiling
> *with* OGRAPISPY_ENABLED and then running *without*
> OGR_API_SPY_FILE/OGR_API_SPY_SNAPSHOT_PATH
> set?

Hi Robert,

Hopefully no, see for example :

OGRFeatureH OGR_L_GetNextFeature( OGRLayerH hLayer )

{
    VALIDATE_POINTER1( hLayer, "OGR_L_GetNextFeature", NULL );

#ifdef OGRAPISPY_ENABLED
    if( bOGRAPISpyEnabled )
        OGRAPISpy_L_GetNextFeature(hLayer);
#endif

    return (OGRFeatureH) ((OGRLayer *)hLayer)->GetNextFeature();
}

I cannot imagine something with less overhead. (if you exclude dynamic binary 
patching techniques ;-) )

OGROpen() and OGR_Dr_CreateDataSource() call a tracing function that tests if 
the env. variable is set, and if so set the boolean bOGRAPISpyEnabled.

Even

> 
> Rob :)
> 
> 
> On Sun, Aug 31, 2014 at 11:34 PM, Even Rouault <even.rouault at spatialys.com>
> 
> wrote:
> > Hi,
> > 
> > This will not be of interest for the crowds, but mainly for OGR driver
> > developers (and potentially also to get precise bug reports from users).
> > I'm
> > currently adding update capabilities to the MITAB driver, and while
> > playing with QGIS, there are sometimes sequences of OGR calls that
> > trigger bugs, but
> > that I had issues to replicate afterwards. This spy mechanism enables to
> > have
> > recording of all relevant calls to be able to replicate them exactly
> > afterwards.
> > 
> > Doc to use it : http://www.gdal.org/ograpispy_8h.html
> > 
> > Related autotest script :
> > http://svn.osgeo.org/gdal/trunk/autotest/ogr/ograpispy.py
> > 
> > Even
> > 
> > --
> > Spatialys - Geospatial professional services
> > http://www.spatialys.com
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list