[QGIS-Developer] Profiler?

João Gaspar joao.f.r.gaspar at gmail.com
Sun May 24 03:10:09 PDT 2020


Hi devs,
I don't know if this helps as well or is related with the Profiler subject
but Michel Stuyts share a QGIS plugin  Plugin Load Times that measures the
load time of qgis plugins (not the core but measure all the others).
More info in here:

*If QGIS takes long to start, it is probably because some of the plugins
you installed take a long time to load at startup. This plugin shows the
latest load time of each plugin (QGIS startup, plugin installation,...). It
does not give you information about the speed of plugins when they are
used. With the information provided by this plugin you can easily decide
which plugins to disable, to make QGIS start faster.*

This plugin adds a toolbar button and an item to the plugin menu to see how
long each plugin loads in QGIS 3. It shows the QGIS python variable
*qgis.utils.plugin_times
<https://github.com/qgis/QGIS/blob/b1b647349ac5d43a6f0b1a308dd7480f11dded63/python/utils.py#L358>*
in an easy to understand window. It's possible to sort the results based on
plugin name or on load time. In the latest version it also has a pie chart
with the data visualized.

Some core plugins are not available in the QGIS Python Variable, so they
will not be shown in this plugin. For the following core plugins no
information about the load time is available in "Plugin Load Times":

   - Coordinate Capture
   - eViz
   - Geometry Checker
   - Georeferencer GDAL
   - GPS Tools
   - GRASS 7
   - OfflineEditing
   - Topology Checker



https://gitlab.com/GIS-projects/Plugin-Load-Times

Search in plugin manager for Plugin Load Times or

https://plugins.qgis.org/plugins/PluginLoadTimes/

Cheers,
João Gaspar


Nyall Dawson <nyall.dawson at gmail.com> escreveu no dia domingo, 24/05/2020
à(s) 10:29:

> On Sat, 23 May 2020 at 22:19, Nathan Woodrow <madmanwoo at gmail.com> wrote:
> >
> > Correct. QgsRuntimeProfiler is the tool that can do it.
> >
> > https://qgis.org/api/classQgsRuntimeProfiler.html
> >
> > In Python you can access it using this:
> >
> >  QgsApplication.instance().profiler()
> >
> > An example:
> >
> >    QgsApplication.instance().profiler().start("my_thing")
> > # long expensive stuff
> >      QgsApplication.instance().profiler().end()
>
>
> Or the newer, more Pythonic  way:
>
>    with QgsRuntimeProfiler.profile('loading something'):
>       # do some stuff
>
> I'd encourage plugin authors to use this in their plugins
> initialisation code as much as makes sense!
>
> Nyall
>
> >
> >
> >
> > On Sat, May 23, 2020 at 9:38 PM Richard Duivenvoorde <
> rdmailings at duif.net> wrote:
> >>
> >> On 5/23/20 11:42 AM, Sebastian M. Ernst wrote:
> >>
> >> > @Richard How does your Citrix setup / architecture look like
> >> > (approximately)?
> >>
> >> I'll ask around for more details, as I'm there just as a user of that
> setup.
> >>
> >> But I did try a lot of things: and exactly what you tell: their virus
> >> scanner was pushing some hash version of all python files to some online
> >> service. So I disabled it...
> >> But still... And off course they are working with some network shares,
> >> so I will try out some of your other idea's
> >>
> >> > @Nathan & @Nyall Where in QGIS' source can I find the profiling tool?
> I
> >> > just searched and could not locate it ... Would you consider adding
> >> > support for a Python profiler to it, e.g. [1], [2] or [3]? The
> relevant
> >> > code could (conditionally) be injected somewhere around here [4] or
> here
> >> > [5]. I have played with this idea a while ago. It works in principle,
> >> > but a proper integration into your GUI would be great ...
> >>
> >> In my debug build, using
> >> export QGIS_DEBUG=5
> >>
> >> I see:
> >>
> >> ../src/core/symbology/qgssymbollayerutils.cpp:3936 :
> >> (svgSymbolNameToPath) [0ms] Svg found in alternative path
> >> ../src/core/qgsruntimeprofiler.cpp:80 : (end) [0ms] PROFILE: Load
> >> default style database/Load symbols/topo camp - 0.001
> >> ../src/core/qgsruntimeprofiler.cpp:80 : (end) [0ms] PROFILE: Load
> >> default style database/Load symbols/topo foot - 0
> >> ../src/core/qgsruntimeprofiler.cpp:80 : (end) [0ms] PROFILE: Load
> >> default style database/Load symbols/topo forest - 0
> >>
> >> So:
> >>
> https://github.com/qgis/QGIS/blob/master/src/core/qgsruntimeprofiler.cpp
> :-)
> >>
> >> Regards,
> >>
> >> Richard Duivenvoorde
> >> _______________________________________________
> >> QGIS-Developer mailing list
> >> QGIS-Developer at lists.osgeo.org
> >> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> >> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200524/457a6a2a/attachment.html>


More information about the QGIS-Developer mailing list