Measuring loading times in QGIS using PyQGIS?

Go to settings > options > rendering, enable debug map canvas refresh, have a look at the message log. Done.

enter image description here

enter image description here


What about this:

def start_signal(): print "started: {0}".format(datetime.datetime.now())
def stop_signal():  print "finished: {0}".format(datetime.datetime.now())

iface.mapCanvas().renderStarting.connect(start_signal)
iface.mapCanvas().renderComplete.connect(stop_signal)

layer = QgsRasterLayer('A:\Temp\dop_test.tif', 'test_layer')
QgsMapLayerRegistry.instance().addMapLayer(layer)

<qgis._core.QgsRasterLayer object at 0x0000000023B49950>
started: 2018-06-15 10:37:44.438000
finished: 2018-06-15 10:37:44.553000

Unfortunately its less like a monitor - because, its necessary to load the layers via Python. Its not working if you are loading a project, because there is no information about the "current layer" in the connected signals.