How to measure the time of a Maya script?

巧了我就是萌 提交于 2019-12-12 01:47:36

问题


I have several methods implemented in MEL, and I would like to measure its performance. Is there any way to measure execution time of a fragment of code? Something equivalent to "getCurrentTime" in other languages.


回答1:


the timerX() command will give you seconds since Maya was started, so you can grab that and do the math:

float $start = timerX();



回答2:


Timer

// Example 1: Simple timing
//
$startTime = `timerX`;
// code that is being timed
$totalTime = `timerX -startTime $startTime`;
print ("Total Time: "+$totalTime+"\n");


来源:https://stackoverflow.com/questions/29150421/how-to-measure-the-time-of-a-maya-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!