How to measure the time of a Maya script?

2019-09-06 22:51发布

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.

2条回答
何必那么认真
2楼-- · 2019-09-06 23:35

Timer

// Example 1: Simple timing
//
$startTime = `timerX`;
// code that is being timed
$totalTime = `timerX -startTime $startTime`;
print ("Total Time: "+$totalTime+"\n");
查看更多
该账号已被封号
3楼-- · 2019-09-06 23:52

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

float $start = timerX();
查看更多
登录 后发表回答