Measure Execution Time
There are situations where you would like to know the duration of execution of an AIMMS code-block. In AIMMS Developer, you can do this easily by using the built-in Profiler, accessed through Tools -> Diagnostic Tools -> Profiler. This profiler will provide you with information about how long each statement in an execution took, as well as how long the evaluation of the definition of a parameter took. More information about the profiler can be found in The AIMMS profiler.
You can also start the profiler using the function
It is common to make a call to this function in the initialization procedures so that you can always
have the profiler available while developing an AIMMS application.
In addition, you can query the profiler using the procedure
See all related functions related to Profiler in AIMMS Function Reference - Development Support.
However, using the AIMMS Profiler has two rather minor disadvantages when measuring execution time:
The AIMMS Profiler cannot be active when the AIMMS Debugger is active.
The AIMMS Profiler does not support directly the measuring of a code fragment, or the measuring of a piece of code executed when some condition is true.
And the method to use is simple:
3! Any code
5p_elapsedTime := stopwatch::fnc_elapsed();