<div dir="ltr"><div>Hi,</div><div><br></div><div>I am looking for a way to audit a QGIS projects in terms of layer rendering time.</div><div><br></div><div>I was able to measuring the rendering every time I refresh the the map canvas, change layers or change extent, using the following code (inspired by Anita code):</div><div><br></div><div><span style="font-family:monospace">from datetime import datetime<br><br>def get_time():<br>    t1 = datetime.now()<br>    print('Rendering time:',t1-t0, 'seconds')<br><br>def reset_time():<br>    global t0<br>    t0 = datetime.now()<br><br>canvas = iface.mapCanvas()<br>canvas.mapCanvasRefreshed.connect(get_time)<br>canvas.extentsChanged.connect(reset_time)<br>canvas.layersChanged.connect(reset_time)</span></div><div><span style="font-family:monospace"><br></span></div><div><font face="arial,sans-serif">Now, I wanted to programmatically zoom in, zoom out, enable and disable layers, etc... but If I give two or more of these commands together, each command won't wait for the other to finish rendering, therefore I am unable to measure the time.</font></div><div><font face="arial,sans-serif"><br></font></div><div><font face="arial,sans-serif">For example:<br></font></div><div><span style="font-family:monospace">iface.actionZoomFullExtent()<br>canvas.zoomByFactor(0.5)</span></div><div><span style="font-family:monospace"><br></span></div><div><font face="arial,sans-serif">Only returns the time for the last zoom to render.</font></div><div><font face="arial,sans-serif"><br></font></div><div><font face="arial,sans-serif">I have tried using time.wait() but that stops the rendering all together.<br></font></div><div><font face="arial,sans-serif"><br></font></div><div><font face="arial,sans-serif"></font></div><div><font face="arial,sans-serif">Thanks,</font></div><div><font face="arial,sans-serif"><br></font></div><div><font face="arial,sans-serif">Alexandre Neto<br></font></div></div>