[QGIS-Developer] Profiler times in Python

Michel Stuyts michel.stuyts at edegem.be
Fri May 5 05:47:15 PDT 2023


Until now I always used qgis.utils.plugin_times, but I noticed the different values between this variable and the “Debugging/Development Tools” Panel. That’s the reason I wanted the profiler values.  The qgis.utils.plugin_times variable has 0 loading time as value for some plugins, which is also very unlikely.

Does anyone know the difference these two sources of plugin loading times?


Michel

Van: Etienne Trimaille <etienne.trimaille at gmail.com>
Verzonden: vrijdag 5 mei 2023 14:03
Aan: Michel Stuyts <michel.stuyts at edegem.be>
CC: qgis-developer <qgis-developer at lists.osgeo.org>
Onderwerp: Re: [QGIS-Developer] Profiler times in Python

U ontvangt niet vaak e-mail van etienne.trimaille at gmail.com<mailto:etienne.trimaille at gmail.com>. Meer informatie over waarom dit belangrijk is<https://aka.ms/LearnAboutSenderIdentification>
One line I know, maybe this is enough :

>>> from qgis.utils import plugin_times
>>> plugin_times

It's not using the profiler. Values are different from the Profiler, after a quick look...

Le ven. 5 mai 2023 à 10:21, Michel Stuyts via QGIS-Developer <qgis-developer at lists.osgeo.org<mailto:qgis-developer at lists.osgeo.org>> a écrit :
I want to use the data on plugins from the Profiler.  In the “Debugging/Development Tools” Panel I can see both the total time for all plugins and the individual time per plugin.  With the following Python code, I want to get the same data in Python:

profiler = QgsApplication.profiler()
for child in profiler.childGroups():
    childGroup = profiler.childGroups(child)
    if child == 'Load plugins':
        print(child, profiler.profileTime(child))
        for subGroup in childGroup:
            print(subGroup, profiler.profileTime(subGroup))

It shows the total time for all plugins just fine as “Load plugins” with the same number of seconds as in the Panel, but for the individual plugins I get 0.0 as time for all plugins.  What do I do wrong or is it a bug?


Michel Stuyts
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer at lists.osgeo.org<mailto: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/20230505/6cd9536a/attachment-0001.htm>


More information about the QGIS-Developer mailing list