[Qgis-developer] profiling python plugins

Robb Hill rhill at gunngrp.com
Thu Sep 24 07:26:50 PDT 2015


Hello,

I'm seeking advice on how to profile python plugins running within QGIS.
Besides providing a useful tool to the development environment for
plugins, it would
also provide useful information from our continuous build process.

My hope is that there is some way to conditionally start a profiler when
the python interpreter is initialized within QGIS.  This would help avoid
placing profiling code in the plugin source.

The interpreter appears to be initialized here...

*qgspythonutilsimpl.cpp*
    void QgsPythonUtilsImpl::init()

Is it possible to conditionally invoke the embedded profiling functions
during initialization in
QgsPythonUtilsImpl::init?
    PyEval_SetProfile(Py_tracefunc func, PyObject *obj)
    PyEval_SetTrace(Py_tracefunc func, PyObject *obj)
    PyObject* PyEval_GetCallStats(PyObject *self)


Or maybe there is there a way to utilize startup.py to provide profiling?

Ideally I would like to call a QGIS method to provide the results in a
python console or when executing a test script.

Any guidance is appreciated.

Thanks,
Robb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150924/aa90e08e/attachment.html>


More information about the Qgis-developer mailing list