- Tags:
- profiler
Profiling
The profiler is a tool that gives dynamic execution time information. It is very useful to detect which parts of a program need to be optimized most.
To use the profiler, the first thing to do is to enable it.
To enable the profiler:
- Open the Project Settings dialog.
- In the Target section, enable Profile.
- Click OK.
- You must recompile your project for the changes to take effect.
By default the profiler will profile the entire program. However it is possible to enable or disable the profiler on certain clusters only. To do this:
- Open the Project Settings dialog.
- In the Clusters property, check the Profile boolean value in the clusters where you want the profiler to be enabled.
- Click Apply or OK.
- You must recompile your project for the changes to take effect.
It is also possible to dynamically start and stop the profiler in a program. To do this:
- Create an object of type PROFILING_SETTING .
- Call start_profiling on this object to start the profiler.
- Call stop_profiling on this object to stop the profiler.
In the root feature:
local
ps: PROFILING_SETTING
-- Other local variables if necessary.
do
create ps.make
ps.stop_profiling
-- Real program execution.
ps.start_profiling
end
And in the feature(s) that needs to be profiled:
local
ps: PROFILING_SETTING
-- Other local variables if necessary.
do
create ps.make
ps.start_profiling
-- What needs to be profiled.
ps.stop_profiling
end
Once the profiler has been enabled and the program has been recompiled, it is necessary to launch the program.
When the program exits, a file named 'profinfo' should be generated next to it.
All that's left to do is launch the Profiler wizard and follow the instructions.