mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
Add timing for plugin loading
This commit is contained in:
parent
66e6820ba1
commit
0181df5553
@ -39,6 +39,7 @@ import re
|
||||
import ConfigParser
|
||||
import warnings
|
||||
import codecs
|
||||
import time
|
||||
|
||||
#######################
|
||||
# ERROR HANDLING
|
||||
@ -106,6 +107,8 @@ plugin_paths = []
|
||||
# dictionary of plugins
|
||||
plugins = {}
|
||||
|
||||
plugin_times = {}
|
||||
|
||||
# list of active (started) plugins
|
||||
active_plugins = []
|
||||
|
||||
@ -190,7 +193,7 @@ def loadPlugin(packageName):
|
||||
|
||||
def startPlugin(packageName):
|
||||
""" initialize the plugin """
|
||||
global plugins, active_plugins, iface
|
||||
global plugins, active_plugins, iface, plugin_times
|
||||
|
||||
if packageName in active_plugins: return False
|
||||
if packageName not in sys.modules: return False
|
||||
@ -199,6 +202,7 @@ def startPlugin(packageName):
|
||||
|
||||
errMsg = QCoreApplication.translate("Python", "Couldn't load plugin %s" ) % packageName
|
||||
|
||||
start = time.clock()
|
||||
# create an instance of the plugin
|
||||
try:
|
||||
plugins[packageName] = package.classFactory(iface)
|
||||
@ -220,6 +224,8 @@ def startPlugin(packageName):
|
||||
|
||||
# add to active plugins
|
||||
active_plugins.append(packageName)
|
||||
end = time.end()
|
||||
plugin_times[packageName] = "{0:02f}s".format(end - start)
|
||||
|
||||
return True
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user