Go to: Synopsis. Flags. Return value. Python examples.
timerX([startTime=double])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
timerX is undoable, queryable, and editable.
Used to calculate elapsed time. This command returns sub-second accurate time values. It is useful from scripts for timing the length of operations. Call this command before and after the operation you wish to time. On the first call, do not use any flags. It will return the start time. Save this value. After the operation, call this command a second time, and pass the saved start time using the -st flag. The elapsed time will be returned.| Long name (short name) | [argument types] | Properties | ||
|---|---|---|---|---|
startTime(st)
|
double
|
|
||
|
||||
import maya.cmds as cmds # Example 1: Simple timing # start = cmds.timerX() # code that is being timed totalTime = cmds.timerX(startTime=start) print "Total time: ", totalTime # Example 2: Iterative timing # startTime = cmds.timerX() for i in range(0,5): elapsedTime = cmds.timerX() print "Elapsed Time: ", elapsedTime # Example 3: Stacked timing calls # startTime1 = cmds.timerX() startTime2 = cmds.timerX() for i in range(0,5): elapsedTime = cmds.timerX() print "Elapsed Time: ", elapsedTime totalTime = cmds.timerX(startTime=startTime1) print "Total Time: ", totalTime