'What is the best way to playback animation exactly N times in blender?

Like in the title. Can be anything, python script or whatever. Also I need to measure time of the playback and/or average framerate. Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source