Time for a procedure to run in NetLogo

我的未来我决定 提交于 2019-11-29 14:44:57

Charles' suggestion of the profiler extension is a great. The profiler extension is incredibly useful. However, it may be overkill for your situation.

Checkout reset-timer and timer. reset-timer sets an internal timer to 0, and then timer reports the amount of time that has passed since reset-timer was called (in seconds). The resolution is on the order of milliseconds, but depends on the system.

To time a single procedure call, you'd do something like:

reset-timer
my-procedure
print timer

If you want to get a sense of the average time a procedure takes, you can simply put it in a repeat block:

reset-timer
repeat 1000 [ my-procedure ]
print timer

The profiler extension is designed to do just that. See the NetLogo User Manual at http://ccl.northwestern.edu/netlogo/docs/profiler.html for instructions on its use.

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