Measuring frame/playback rate in Maya

19 views
Skip to first unread message

Ravi Jagannadhan

unread,
Dec 30, 2019, 10:12:17 PM12/30/19
to python_in...@googlegroups.com
Hi there, I need to automate some testing in Maya and am looking to script something that will measure the playback performance. Does anyone have a scriptlet that does this already? Thanks in advance.

Thank you for your time,
Ravi
--
Where we have strong emotions, we're liable to fool ourselves - Carl Sagan

Marcus Ottosson

unread,
Dec 31, 2019, 3:03:00 AM12/31/19
to python_in...@googlegroups.com

Here you go, a scriptlet fresh out of the oven. Untested, but you get the gist.

import time
from maya import cmds

cmds.currentTime(1)  
t0 = time.time()
cmds.currentTime(2)  
t1 = time.time()
duration = t1 - t0
print("The time taken was %.2f s" % duration)
print("%d fps" % (1 / duration))

From here, you could measure across multiple frames and draw a plot or to a median/average, or measure a specific frame or section of frames. You could disable viewport rendering, or call it from mayapy for results not including rendering. On Linux, you may want to use time.clock(), or not. Etc. etc.


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CADHeb2ZchRRp6y97VKrHPJtvK1ZSr-%3DTyjzRB9JYc5KjY_W%3Djg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages