Measure redraw performance


Is there any reliable way to measure the redraw-perfomance of the whole plugin-GUI? I would like to throttle down framerate on slower systems (because too high framerate will block the message thread to much, the GUI gets unresponsive), but still have a high framerate on fast systems.

One way could be to measure time between to redraws (in the paint callback), calculate a average value, and make the refresh-rate smaller if its less than expected. But is there a more elegant solution?