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");