NetLogo Procedure Runtime

How to find the time required to start a procedure in NetLogo?

Using ticks defined in NetLogo is inaccurate for my purposes.

A vague idea could subtract the system time at the beginning and end if possible.

But I do not know about any methods defined in NetLogo that would allow me to do this.

+3
netlogo
source share
2 answers

Charles's suggestion for a profiler extension is great. The profiler extension is incredibly useful. However, this may be redundant for your situation.

Place an order reset-timer and timer . reset-timer sets the internal timer to 0, and then timer reports the time elapsed since reset-timer called (in seconds). Resolution is on the order of milliseconds, but depends on the system.

To call a single procedure call, you should do something like:

 reset-timer my-procedure print timer 

If you want to understand the average execution time of a procedure, you can simply put it in a repeat block:

 reset-timer repeat 1000 [ my-procedure ] print timer 
+3
source share

The profiler extension is designed for just that. For instructions on how to use it, see the NetLogo User Guide at http://ccl.northwestern.edu/netlogo/docs/profiler.html .

+4
source share

All Articles